FindCABLE.cmake 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. Find CABLE
  7. This module finds if CABLE is installed and determines where the
  8. include files and libraries are. This code sets the following
  9. variables:
  10. ::
  11. CABLE the path to the cable executable
  12. CABLE_TCL_LIBRARY the path to the Tcl wrapper library
  13. CABLE_INCLUDE_DIR the path to the include directory
  14. To build Tcl wrappers, you should add shared library and link it to
  15. ${CABLE_TCL_LIBRARY}. You should also add ${CABLE_INCLUDE_DIR} as an
  16. include directory.
  17. #]=======================================================================]
  18. if(NOT CABLE)
  19. find_path(CABLE_BUILD_DIR cableVersion.h)
  20. endif()
  21. if(CABLE_BUILD_DIR)
  22. load_cache(${CABLE_BUILD_DIR}
  23. EXCLUDE
  24. BUILD_SHARED_LIBS
  25. LIBRARY_OUTPUT_PATH
  26. EXECUTABLE_OUTPUT_PATH
  27. MAKECOMMAND
  28. CMAKE_INSTALL_PREFIX
  29. INCLUDE_INTERNALS
  30. CABLE_LIBRARY_PATH
  31. CABLE_EXECUTABLE_PATH)
  32. if(CABLE_LIBRARY_PATH)
  33. find_library(CABLE_TCL_LIBRARY NAMES CableTclFacility PATHS
  34. ${CABLE_LIBRARY_PATH}
  35. ${CABLE_LIBRARY_PATH}/*)
  36. else()
  37. find_library(CABLE_TCL_LIBRARY NAMES CableTclFacility PATHS
  38. ${CABLE_BINARY_DIR}/CableTclFacility
  39. ${CABLE_BINARY_DIR}/CableTclFacility/*)
  40. endif()
  41. if(CABLE_EXECUTABLE_PATH)
  42. find_program(CABLE NAMES cable PATHS
  43. ${CABLE_EXECUTABLE_PATH}
  44. ${CABLE_EXECUTABLE_PATH}/*)
  45. else()
  46. find_program(CABLE NAMES cable PATHS
  47. ${CABLE_BINARY_DIR}/Executables
  48. ${CABLE_BINARY_DIR}/Executables/*)
  49. endif()
  50. find_path(CABLE_INCLUDE_DIR CableTclFacility/ctCalls.h
  51. ${CABLE_SOURCE_DIR})
  52. else()
  53. # Find the cable executable in the path.
  54. find_program(CABLE NAMES cable)
  55. # Get the path where the executable sits, but without the executable
  56. # name on it.
  57. get_filename_component(CABLE_ROOT_BIN ${CABLE} PATH)
  58. # Find the cable include directory in a path relative to the cable
  59. # executable.
  60. find_path(CABLE_INCLUDE_DIR CableTclFacility/ctCalls.h
  61. ${CABLE_ROOT_BIN}/../include/Cable)
  62. # Find the WrapTclFacility library in a path relative to the cable
  63. # executable.
  64. find_library(CABLE_TCL_LIBRARY NAMES CableTclFacility PATHS
  65. ${CABLE_ROOT_BIN}/../lib/Cable)
  66. endif()