STYLE: Nightly Version update
[cmake.git] / Modules / FindCABLE.cmake
blob0d970e1463c23902de9f1b23866e7afed24bbc7d
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                CMAKE_INSTALL_PREFIX
26              INCLUDE_INTERNALS
27                CABLE_LIBRARY_PATH
28                CABLE_EXECUTABLE_PATH)
30   IF(CABLE_LIBRARY_PATH)
31     FIND_LIBRARY(CABLE_TCL_LIBRARY NAMES CableTclFacility PATHS
32                  ${CABLE_LIBRARY_PATH}
33                  ${CABLE_LIBRARY_PATH}/*)
34   ELSE(CABLE_LIBRARY_PATH)
35     FIND_LIBRARY(CABLE_TCL_LIBRARY NAMES CableTclFacility PATHS
36                  ${CABLE_BINARY_DIR}/CableTclFacility
37                  ${CABLE_BINARY_DIR}/CableTclFacility/*)
38   ENDIF(CABLE_LIBRARY_PATH)
40   IF(CABLE_EXECUTABLE_PATH)
41     FIND_PROGRAM(CABLE NAMES cable PATHS
42                  ${CABLE_EXECUTABLE_PATH}
43                  ${CABLE_EXECUTABLE_PATH}/*)
44   ELSE(CABLE_EXECUTABLE_PATH)
45     FIND_PROGRAM(CABLE NAMES cable PATHS
46                  ${CABLE_BINARY_DIR}/Executables
47                  ${CABLE_BINARY_DIR}/Executables/*)
48   ENDIF(CABLE_EXECUTABLE_PATH)
50   FIND_PATH(CABLE_INCLUDE_DIR CableTclFacility/ctCalls.h
51             ${CABLE_SOURCE_DIR})
52 ELSE(CABLE_BUILD_DIR)
53   # Find the cable executable in the path.
54   FIND_PROGRAM(CABLE NAMES cable)
56   # Get the path where the executable sits, but without the executable
57   # name on it.
58   GET_FILENAME_COMPONENT(CABLE_ROOT_BIN ${CABLE} PATH)
60   # Find the cable include directory in a path relative to the cable
61   # executable.
62   FIND_PATH(CABLE_INCLUDE_DIR CableTclFacility/ctCalls.h
63             ${CABLE_ROOT_BIN}/../include/Cable)
65   # Find the WrapTclFacility library in a path relative to the cable
66   # executable.
67   FIND_LIBRARY(CABLE_TCL_LIBRARY NAMES CableTclFacility PATHS
68                ${CABLE_ROOT_BIN}/../lib/Cable)
69 ENDIF(CABLE_BUILD_DIR)