FindCABLE.cmake 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 cable.README.txt)
  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. ELSE(CABLE_LIBRARY_OUTPUT_PATH)
  30. FIND_LIBRARY(CABLE_TCL_LIBRARY NAMES WrapTclFacility PATHS
  31. ${CABLE_BINARY_DIR}/WrapTclFacility)
  32. ENDIF(CABLE_LIBRARY_OUTPUT_PATH)
  33. IF(CABLE_EXECUTABLE_OUTPUT_PATH)
  34. FIND_PROGRAM(CABLE NAMES cable PATHS ${CABLE_EXECUTABLE_OUTPUT_PATH})
  35. ELSE(CABLE_EXECUTABLE_OUTPUT_PATH)
  36. FIND_PROGRAM(CABLE NAMES cable PATHS ${CABLE_BINARY_DIR}/Executables)
  37. ENDIF(CABLE_EXECUTABLE_OUTPUT_PATH)
  38. SET(CABLE_INCLUDE_DIR ${CABLE_SOURCE_DIR}
  39. CACHE STRING "Include path for Cable headers.")
  40. ELSE(CABLE_BUILD_DIR)
  41. # Use some tricks to find the cable executable relative to somewhere
  42. # in the system search path. CMake will collapse the relative paths
  43. # automatically.
  44. FIND_PROGRAM(CABLE
  45. NAMES cable
  46. ../share/Cable/bin/cable
  47. ../Cable/bin/cable
  48. PATHS /usr/share/Cable/bin
  49. /usr/local/share/Cable/bin
  50. "C:/Program Files/Cable/bin"
  51. )
  52. # Get the path where the executable sits, but without the executable
  53. # name on it.
  54. GET_FILENAME_COMPONENT(CABLE_ROOT_BIN ${CABLE} PATH)
  55. # Find the cable include directory in a path relative to the cable
  56. # executable.
  57. FIND_PATH(CABLE_INCLUDE_DIR WrapTclFacility/wrapCalls.h
  58. ${CABLE_ROOT_BIN}/../include)
  59. # Find the WrapTclFacility library in a path relative to the cable
  60. # executable.
  61. FIND_LIBRARY(CABLE_TCL_LIBRARY NAMES WrapTclFacility PATHS
  62. ${CABLE_ROOT_BIN}/../lib)
  63. ENDIF(CABLE_BUILD_DIR)