FindCABLE.cmake 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #
  2. # This module finds if CABLE is installed and determines where the
  3. # include files and libraries are. This code sets the following variables:
  4. #
  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
  8. #
  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.
  12. #
  13. IF(NOT CABLE)
  14. FIND_PATH(CABLE_BUILD_DIR cableVersion.h)
  15. ENDIF(NOT CABLE)
  16. IF(CABLE_BUILD_DIR)
  17. LOAD_CACHE(${CABLE_BUILD_DIR}
  18. EXCLUDE
  19. BUILD_SHARED_LIBS
  20. LIBRARY_OUTPUT_PATH
  21. EXECUTABLE_OUTPUT_PATH
  22. MAKECOMMAND
  23. INCLUDE_INTERNALS
  24. CABLE_LIBRARY_OUTPUT_PATH
  25. CABLE_EXECUTABLE_OUTPUT_PATH)
  26. IF(CABLE_LIBRARY_OUTPUT_PATH)
  27. FIND_LIBRARY(CABLE_TCL_LIBRARY NAMES WrapTclFacility PATHS
  28. ${CABLE_LIBRARY_OUTPUT_PATH}
  29. ${CABLE_LIBRARY_OUTPUT_PATH}/*)
  30. ELSE(CABLE_LIBRARY_OUTPUT_PATH)
  31. FIND_LIBRARY(CABLE_TCL_LIBRARY NAMES WrapTclFacility PATHS
  32. ${CABLE_BINARY_DIR}/WrapTclFacility
  33. ${CABLE_BINARY_DIR}/WrapTclFacility/*)
  34. ENDIF(CABLE_LIBRARY_OUTPUT_PATH)
  35. IF(CABLE_EXECUTABLE_OUTPUT_PATH)
  36. FIND_PROGRAM(CABLE NAMES cable PATHS
  37. ${CABLE_EXECUTABLE_OUTPUT_PATH}
  38. ${CABLE_EXECUTABLE_OUTPUT_PATH}/*)
  39. ELSE(CABLE_EXECUTABLE_OUTPUT_PATH)
  40. FIND_PROGRAM(CABLE NAMES cable PATHS
  41. ${CABLE_BINARY_DIR}/Executables
  42. ${CABLE_BINARY_DIR}/Executables/*)
  43. ENDIF(CABLE_EXECUTABLE_OUTPUT_PATH)
  44. SET(CABLE_INCLUDE_DIR ${CABLE_SOURCE_DIR}
  45. CACHE STRING "Include path for Cable headers.")
  46. ELSE(CABLE_BUILD_DIR)
  47. # Use some tricks to find the cable executable relative to somewhere
  48. # in the system search path. CMake will collapse the relative paths
  49. # automatically.
  50. FIND_PROGRAM(CABLE
  51. NAMES cable
  52. ../share/Cable/bin/cable
  53. ../Cable/bin/cable
  54. PATHS /usr/share/Cable/bin
  55. /usr/local/share/Cable/bin
  56. "C:/Program Files/Cable/bin"
  57. )
  58. # Get the path where the executable sits, but without the executable
  59. # name on it.
  60. GET_FILENAME_COMPONENT(CABLE_ROOT_BIN ${CABLE} PATH)
  61. # Find the cable include directory in a path relative to the cable
  62. # executable.
  63. FIND_PATH(CABLE_INCLUDE_DIR WrapTclFacility/wrapCalls.h
  64. ${CABLE_ROOT_BIN}/../include)
  65. # Find the WrapTclFacility library in a path relative to the cable
  66. # executable.
  67. FIND_LIBRARY(CABLE_TCL_LIBRARY NAMES WrapTclFacility PATHS
  68. ${CABLE_ROOT_BIN}/../lib)
  69. ENDIF(CABLE_BUILD_DIR)