1# Distributed under the OSI-approved BSD 3-Clause License. See accompanying 2# file Copyright.txt or https://cmake.org/licensing for details. 3 4#[=======================================================================[.rst: 5FindCABLE 6--------- 7 8Find CABLE 9 10This module finds if CABLE is installed and determines where the 11include files and libraries are. This code sets the following 12variables: 13 14:: 15 16 CABLE the path to the cable executable 17 CABLE_TCL_LIBRARY the path to the Tcl wrapper library 18 CABLE_INCLUDE_DIR the path to the include directory 19 20 21 22To build Tcl wrappers, you should add shared library and link it to 23${CABLE_TCL_LIBRARY}. You should also add ${CABLE_INCLUDE_DIR} as an 24include directory. 25#]=======================================================================] 26 27if(NOT CABLE) 28 find_path(CABLE_BUILD_DIR cableVersion.h) 29endif() 30 31if(CABLE_BUILD_DIR) 32 load_cache(${CABLE_BUILD_DIR} 33 EXCLUDE 34 BUILD_SHARED_LIBS 35 LIBRARY_OUTPUT_PATH 36 EXECUTABLE_OUTPUT_PATH 37 MAKECOMMAND 38 CMAKE_INSTALL_PREFIX 39 INCLUDE_INTERNALS 40 CABLE_LIBRARY_PATH 41 CABLE_EXECUTABLE_PATH) 42 43 if(CABLE_LIBRARY_PATH) 44 find_library(CABLE_TCL_LIBRARY NAMES CableTclFacility PATHS 45 ${CABLE_LIBRARY_PATH} 46 ${CABLE_LIBRARY_PATH}/*) 47 else() 48 find_library(CABLE_TCL_LIBRARY NAMES CableTclFacility PATHS 49 ${CABLE_BINARY_DIR}/CableTclFacility 50 ${CABLE_BINARY_DIR}/CableTclFacility/*) 51 endif() 52 53 if(CABLE_EXECUTABLE_PATH) 54 find_program(CABLE NAMES cable PATHS 55 ${CABLE_EXECUTABLE_PATH} 56 ${CABLE_EXECUTABLE_PATH}/*) 57 else() 58 find_program(CABLE NAMES cable PATHS 59 ${CABLE_BINARY_DIR}/Executables 60 ${CABLE_BINARY_DIR}/Executables/*) 61 endif() 62 63 find_path(CABLE_INCLUDE_DIR CableTclFacility/ctCalls.h 64 ${CABLE_SOURCE_DIR}) 65else() 66 # Find the cable executable in the path. 67 find_program(CABLE NAMES cable) 68 69 # Get the path where the executable sits, but without the executable 70 # name on it. 71 get_filename_component(CABLE_ROOT_BIN ${CABLE} PATH) 72 73 # Find the cable include directory in a path relative to the cable 74 # executable. 75 find_path(CABLE_INCLUDE_DIR CableTclFacility/ctCalls.h 76 ${CABLE_ROOT_BIN}/../include/Cable) 77 78 # Find the WrapTclFacility library in a path relative to the cable 79 # executable. 80 find_library(CABLE_TCL_LIBRARY NAMES CableTclFacility PATHS 81 ${CABLE_ROOT_BIN}/../lib/Cable) 82endif() 83