FindCABLE.cmake 2.89 KB
Newer Older
1 2 3 4 5 6
#.rst:
# FindCABLE
# ---------
#
# Find CABLE
#
7
# This module finds if CABLE is installed and determines where the
8 9 10 11 12 13 14 15 16
# include files and libraries are.  This code sets the following
# variables:
#
# ::
#
#   CABLE             the path to the cable executable
#   CABLE_TCL_LIBRARY the path to the Tcl wrapper library
#   CABLE_INCLUDE_DIR the path to the include directory
#
17 18
#
#
19
# To build Tcl wrappers, you should add shared library and link it to
20 21
# ${CABLE_TCL_LIBRARY}.  You should also add ${CABLE_INCLUDE_DIR} as an
# include directory.
22

23 24 25 26 27 28 29 30 31 32
#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
33
# (To distribute this file outside of CMake, substitute the full
34 35
#  License text for the above reference.)

36 37
if(NOT CABLE)
  find_path(CABLE_BUILD_DIR cableVersion.h)
38
endif()
39

40 41
if(CABLE_BUILD_DIR)
  load_cache(${CABLE_BUILD_DIR}
42 43 44 45 46
             EXCLUDE
               BUILD_SHARED_LIBS
               LIBRARY_OUTPUT_PATH
               EXECUTABLE_OUTPUT_PATH
               MAKECOMMAND
47
               CMAKE_INSTALL_PREFIX
48
             INCLUDE_INTERNALS
49 50
               CABLE_LIBRARY_PATH
               CABLE_EXECUTABLE_PATH)
51

52 53
  if(CABLE_LIBRARY_PATH)
    find_library(CABLE_TCL_LIBRARY NAMES CableTclFacility PATHS
54 55
                 ${CABLE_LIBRARY_PATH}
                 ${CABLE_LIBRARY_PATH}/*)
56
  else()
57
    find_library(CABLE_TCL_LIBRARY NAMES CableTclFacility PATHS
58 59
                 ${CABLE_BINARY_DIR}/CableTclFacility
                 ${CABLE_BINARY_DIR}/CableTclFacility/*)
60
  endif()
61

62 63
  if(CABLE_EXECUTABLE_PATH)
    find_program(CABLE NAMES cable PATHS
64 65
                 ${CABLE_EXECUTABLE_PATH}
                 ${CABLE_EXECUTABLE_PATH}/*)
66
  else()
67
    find_program(CABLE NAMES cable PATHS
68 69
                 ${CABLE_BINARY_DIR}/Executables
                 ${CABLE_BINARY_DIR}/Executables/*)
70
  endif()
71

72
  find_path(CABLE_INCLUDE_DIR CableTclFacility/ctCalls.h
73
            ${CABLE_SOURCE_DIR})
74
else()
75
  # Find the cable executable in the path.
76
  find_program(CABLE NAMES cable)
77

78 79
  # Get the path where the executable sits, but without the executable
  # name on it.
80
  get_filename_component(CABLE_ROOT_BIN ${CABLE} PATH)
81

82 83
  # Find the cable include directory in a path relative to the cable
  # executable.
84
  find_path(CABLE_INCLUDE_DIR CableTclFacility/ctCalls.h
85
            ${CABLE_ROOT_BIN}/../include/Cable)
86

87 88
  # Find the WrapTclFacility library in a path relative to the cable
  # executable.
89
  find_library(CABLE_TCL_LIBRARY NAMES CableTclFacility PATHS
90
               ${CABLE_ROOT_BIN}/../lib/Cable)
91
endif()