FindCABLE.cmake 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. # - Find CABLE
  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 path to the cable executable
  6. # CABLE_TCL_LIBRARY the path to the Tcl wrapper library
  7. # CABLE_INCLUDE_DIR the path to the 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. # Copyright 2001-2009 Kitware, Inc.
  14. #
  15. # Distributed under the OSI-approved BSD License (the "License");
  16. # see accompanying file Copyright.txt for details.
  17. #
  18. # This software is distributed WITHOUT ANY WARRANTY; without even the
  19. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  20. # See the License for more information.
  21. #=============================================================================
  22. # (To distribute this file outside of CMake, substitute the full
  23. # License text for the above reference.)
  24. IF(NOT CABLE)
  25. FIND_PATH(CABLE_BUILD_DIR cableVersion.h)
  26. ENDIF(NOT CABLE)
  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(CABLE_LIBRARY_PATH)
  43. FIND_LIBRARY(CABLE_TCL_LIBRARY NAMES CableTclFacility PATHS
  44. ${CABLE_BINARY_DIR}/CableTclFacility
  45. ${CABLE_BINARY_DIR}/CableTclFacility/*)
  46. ENDIF(CABLE_LIBRARY_PATH)
  47. IF(CABLE_EXECUTABLE_PATH)
  48. FIND_PROGRAM(CABLE NAMES cable PATHS
  49. ${CABLE_EXECUTABLE_PATH}
  50. ${CABLE_EXECUTABLE_PATH}/*)
  51. ELSE(CABLE_EXECUTABLE_PATH)
  52. FIND_PROGRAM(CABLE NAMES cable PATHS
  53. ${CABLE_BINARY_DIR}/Executables
  54. ${CABLE_BINARY_DIR}/Executables/*)
  55. ENDIF(CABLE_EXECUTABLE_PATH)
  56. FIND_PATH(CABLE_INCLUDE_DIR CableTclFacility/ctCalls.h
  57. ${CABLE_SOURCE_DIR})
  58. ELSE(CABLE_BUILD_DIR)
  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(CABLE_BUILD_DIR)