FindCABLE.cmake 2.4 KB

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