ENH: typo
[cmake.git] / Modules / FindCABLE.cmake
blob5bcbc67f863d2681b27cf1580feccbc0f5045bae
1 # - Find CABLE
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 path to the cable executable
6 #  CABLE_TCL_LIBRARY the path to the Tcl wrapper library
7 #  CABLE_INCLUDE_DIR the path to the 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.
13 IF(NOT CABLE)
14   FIND_PATH(CABLE_BUILD_DIR cableVersion.h)
15 ENDIF(NOT CABLE)
17 IF(CABLE_BUILD_DIR)
18   LOAD_CACHE(${CABLE_BUILD_DIR}
19              EXCLUDE
20                BUILD_SHARED_LIBS
21                LIBRARY_OUTPUT_PATH
22                EXECUTABLE_OUTPUT_PATH
23                MAKECOMMAND
24                CMAKE_INSTALL_PREFIX
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}/../include/Cable)
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/Cable)
68 ENDIF(CABLE_BUILD_DIR)