FindCABLE.cmake 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #.rst:
  2. # FindCABLE
  3. # ---------
  4. #
  5. # Find CABLE
  6. #
  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. # ::
  12. #
  13. # CABLE the path to the cable executable
  14. # CABLE_TCL_LIBRARY the path to the Tcl wrapper library
  15. # CABLE_INCLUDE_DIR the path to the include directory
  16. #
  17. #
  18. #
  19. # To build Tcl wrappers, you should add shared library and link it to
  20. # ${CABLE_TCL_LIBRARY}. You should also add ${CABLE_INCLUDE_DIR} as an
  21. # include directory.
  22. #=============================================================================
  23. # Copyright 2001-2009 Kitware, Inc.
  24. #
  25. # Distributed under the OSI-approved BSD License (the "License");
  26. # see accompanying file Copyright.txt for details.
  27. #
  28. # This software is distributed WITHOUT ANY WARRANTY; without even the
  29. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  30. # See the License for more information.
  31. #=============================================================================
  32. # (To distribute this file outside of CMake, substitute the full
  33. # License text for the above reference.)
  34. if(NOT CABLE)
  35. find_path(CABLE_BUILD_DIR cableVersion.h)
  36. endif()
  37. if(CABLE_BUILD_DIR)
  38. load_cache(${CABLE_BUILD_DIR}
  39. EXCLUDE
  40. BUILD_SHARED_LIBS
  41. LIBRARY_OUTPUT_PATH
  42. EXECUTABLE_OUTPUT_PATH
  43. MAKECOMMAND
  44. CMAKE_INSTALL_PREFIX
  45. INCLUDE_INTERNALS
  46. CABLE_LIBRARY_PATH
  47. CABLE_EXECUTABLE_PATH)
  48. if(CABLE_LIBRARY_PATH)
  49. find_library(CABLE_TCL_LIBRARY NAMES CableTclFacility PATHS
  50. ${CABLE_LIBRARY_PATH}
  51. ${CABLE_LIBRARY_PATH}/*)
  52. else()
  53. find_library(CABLE_TCL_LIBRARY NAMES CableTclFacility PATHS
  54. ${CABLE_BINARY_DIR}/CableTclFacility
  55. ${CABLE_BINARY_DIR}/CableTclFacility/*)
  56. endif()
  57. if(CABLE_EXECUTABLE_PATH)
  58. find_program(CABLE NAMES cable PATHS
  59. ${CABLE_EXECUTABLE_PATH}
  60. ${CABLE_EXECUTABLE_PATH}/*)
  61. else()
  62. find_program(CABLE NAMES cable PATHS
  63. ${CABLE_BINARY_DIR}/Executables
  64. ${CABLE_BINARY_DIR}/Executables/*)
  65. endif()
  66. find_path(CABLE_INCLUDE_DIR CableTclFacility/ctCalls.h
  67. ${CABLE_SOURCE_DIR})
  68. else()
  69. # Find the cable executable in the path.
  70. find_program(CABLE NAMES cable)
  71. # Get the path where the executable sits, but without the executable
  72. # name on it.
  73. get_filename_component(CABLE_ROOT_BIN ${CABLE} PATH)
  74. # Find the cable include directory in a path relative to the cable
  75. # executable.
  76. find_path(CABLE_INCLUDE_DIR CableTclFacility/ctCalls.h
  77. ${CABLE_ROOT_BIN}/../include/Cable)
  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)
  82. endif()