FIX:
[cmake.git] / Modules / FindCABLE.cmake
blob4f163fefa2e5684881436665f0b32338fec2617e
2 # This module finds if CABLE is installed and determines where the
3 # include files and libraries are.  This code sets the following variables:
5 #  CABLE              = the full path to the cable executable
6 #  CABLE_TCL_LIBRARY  = the full path to the Tcl wrapper facility library
7 #  CABLE_INCLUDE_DIR  = the full path to the cable include directory
9 #  To build Tcl wrappers, you should add shared library and link it to
10 #  ${CABLE_TCL_LIBRARY}.  You should also add ${CABLE_INCLUDE_DIR} as
11 #  an include directory.
14 IF(NOT CABLE)
15   FIND_PATH(CABLE_BUILD_DIR cableVersion.h)
16 ENDIF(NOT CABLE)
18 IF(CABLE_BUILD_DIR)
19   LOAD_CACHE(${CABLE_BUILD_DIR}
20              EXCLUDE
21                BUILD_SHARED_LIBS
22                LIBRARY_OUTPUT_PATH
23                EXECUTABLE_OUTPUT_PATH
24                MAKECOMMAND
25              INCLUDE_INTERNALS
26                CABLE_LIBRARY_PATH
27                CABLE_EXECUTABLE_PATH)
29   IF(CABLE_LIBRARY_PATH)
30     FIND_LIBRARY(CABLE_TCL_LIBRARY NAMES CableTclFacility PATHS
31                  ${CABLE_LIBRARY_PATH}
32                  ${CABLE_LIBRARY_PATH}/*)
33   ELSE(CABLE_LIBRARY_PATH)
34     FIND_LIBRARY(CABLE_TCL_LIBRARY NAMES CableTclFacility PATHS
35                  ${CABLE_BINARY_DIR}/CableTclFacility
36                  ${CABLE_BINARY_DIR}/CableTclFacility/*)
37   ENDIF(CABLE_LIBRARY_PATH)
39   IF(CABLE_EXECUTABLE_PATH)
40     FIND_PROGRAM(CABLE NAMES cable PATHS
41                  ${CABLE_EXECUTABLE_PATH}
42                  ${CABLE_EXECUTABLE_PATH}/*)
43   ELSE(CABLE_EXECUTABLE_PATH)
44     FIND_PROGRAM(CABLE NAMES cable PATHS
45                  ${CABLE_BINARY_DIR}/Executables
46                  ${CABLE_BINARY_DIR}/Executables/*)
47   ENDIF(CABLE_EXECUTABLE_PATH)
49   FIND_PATH(CABLE_INCLUDE_DIR CableTclFacility/ctCalls.h
50             ${CABLE_SOURCE_DIR})
51 ELSE(CABLE_BUILD_DIR)
52   # Find the cable executable in the path.
53   FIND_PROGRAM(CABLE NAMES cable)
55   # Get the path where the executable sits, but without the executable
56   # name on it.
57   GET_FILENAME_COMPONENT(CABLE_ROOT_BIN ${CABLE} PATH)
59   # Find the cable include directory in a path relative to the cable
60   # executable.
61   FIND_PATH(CABLE_INCLUDE_DIR CableTclFacility/ctCalls.h
62             ${CABLE_ROOT_BIN}/../share/Cable/include)
64   # Find the WrapTclFacility library in a path relative to the cable
65   # executable.
66   FIND_LIBRARY(CABLE_TCL_LIBRARY NAMES CableTclFacility PATHS
67                ${CABLE_ROOT_BIN}/../lib)  
68 ENDIF(CABLE_BUILD_DIR)