1 # ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # This software is governed by the CeCILL-B license under French law and
8 # abiding by the rules of distribution of free software. You can use,
9 # modify and/ or redistribute the software under the terms of the CeCILL-B
10 # license as circulated by CEA, CNRS and INRIA at the following URL
11 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
12 # or in the file LICENSE.txt.
14 # As a counterpart to the access to the source code and rights to copy,
15 # modify and redistribute granted by the license, users are provided only
16 # with a limited warranty and the software's author, the holder of the
17 # economic rights, and the successive licensors have only limited
20 # The fact that you are presently reading this means that you have had
21 # knowledge of the CeCILL-B license and that you accept its terms.
22 # ------------------------------------------------------------------------ */
25 # - Find a library installation or build tree.
27 # The following variables are set if @LIBRARY_NAME@ is found.
28 # If @LIBRARY_NAME@ is not found, @LIBRARY_NAME@_FOUND is set to false.
29 # @LIBRARY_NAME@_FOUND - Set to true when @LIBRARY_NAME@ is found.
30 # @LIBRARY_NAME@_USE_FILE - CMake file to use @LIBRARY_NAME@.
31 # @LIBRARY_NAME@_MAJOR_VERSION - The @LIBRARY_NAME@ major version number.
32 # @LIBRARY_NAME@_MINOR_VERSION - The @LIBRARY_NAME@ minor version number
34 # @LIBRARY_NAME@_BUILD_VERSION - The @LIBRARY_NAME@ patch level
35 # (meaningless for odd minor).
36 # @LIBRARY_NAME@_INCLUDE_DIRS - Include directories for @LIBRARY_NAME@
37 # @LIBRARY_NAME@_LIBRARY_DIRS - Link directories for @LIBRARY_NAME@ libraries
38 # @LIBRARY_NAME@_LIBRARIES - List of libraries to link against
40 # The following cache entries must be set by the user to locate @LIBRARY_NAME@:
41 # @LIBRARY_NAME@_DIR - The directory containing @LIBRARY_NAME@Config.cmake.
42 # This is either the root of the build tree,
43 # or the lib/@LIBRARY_NAME@ directory. This is the
47 # Construct consitent error messages for use below.
48 SET(@LIBRARY_NAME@_DIR_DESCRIPTION "directory containing @LIBRARY_NAME@Config.cmake. This is either the root of the build tree, or PREFIX/lib/@LIBRARY_NAME@ for an installation.")
49 SET(@LIBRARY_NAME@_NOT_FOUND_MESSAGE "@LIBRARY_NAME@ not found. Set the @LIBRARY_NAME@_DIR cmake cache entry to the ${@LIBRARY_NAME@_DIR_DESCRIPTION}")
51 # Search only if the location is not already known.
52 IF(NOT @LIBRARY_NAME@_DIR)
53 # Get the system search path as a list.
55 STRING(REGEX MATCHALL "[^:]+" @LIBRARY_NAME@_DIR_SEARCH1 "$ENV{PATH}")
57 STRING(REGEX REPLACE "\\\\" "/" @LIBRARY_NAME@_DIR_SEARCH1 "$ENV{PATH}")
59 STRING(REGEX REPLACE "/;" ";" @LIBRARY_NAME@_DIR_SEARCH2 "${@LIBRARY_NAME@_DIR_SEARCH1}")
61 # Construct a set of paths relative to the system search path.
62 SET(@LIBRARY_NAME@_DIR_SEARCH "")
63 FOREACH(dir ${@LIBRARY_NAME@_DIR_SEARCH2})
64 SET(@LIBRARY_NAME@_DIR_SEARCH ${@LIBRARY_NAME@_DIR_SEARCH}
65 ${dir}/../lib/@INSTALL_PATH@
70 # Look for an installation or build tree.
72 FIND_PATH(@LIBRARY_NAME@_DIR Use@LIBRARY_NAME@.cmake
73 # Look for an environment variable @LIBRARY_NAME@_DIR.
74 $ENV{@LIBRARY_NAME@_DIR}
76 # Look in places relative to the system executable search path.
77 ${@LIBRARY_NAME@_DIR_SEARCH}
79 # Look in standard WIN install locations.
80 "$ENV{ProgramFiles}/@LIBRARY_NAME@"
82 # Look in standard UNIX install locations.
83 /usr/local/@INSTALL_PATH@
86 # Read from the CMakeSetup registry entries. It is likely that
87 # @LIBRARY_NAME@ will have been recently built.
88 [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild1]
89 [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild2]
90 [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild3]
91 [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild4]
92 [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild5]
93 [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild6]
94 [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild7]
95 [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild8]
96 [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild9]
97 [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild10]
99 # Help the user find it if we cannot.
100 DOC "The ${@LIBRARY_NAME@_DIR_DESCRIPTION}"
102 ENDIF(NOT @LIBRARY_NAME@_DIR)
104 # If @LIBRARY_NAME@ was found, load the configuration file to get the rest of the
106 IF(@LIBRARY_NAME@_DIR)
107 # Make sure the @LIBRARY_NAME@Config.cmake file exists in the directory provided.
108 IF(EXISTS ${@LIBRARY_NAME@_DIR}/@LIBRARY_NAME@Config.cmake)
110 # We found @LIBRARY_NAME@. Load the settings.
111 SET(@LIBRARY_NAME@_FOUND 1)
112 INCLUDE(${@LIBRARY_NAME@_DIR}/@LIBRARY_NAME@Config.cmake)
114 ENDIF(EXISTS ${@LIBRARY_NAME@_DIR}/@LIBRARY_NAME@Config.cmake)
115 ELSE(@LIBRARY_NAME@_DIR)
116 # We did not find @LIBRARY_NAME@.
117 SET(@LIBRARY_NAME@_FOUND 0)
118 ENDIF(@LIBRARY_NAME@_DIR)
120 #-----------------------------------------------------------------------------
121 IF(NOT @LIBRARY_NAME@_FOUND)
122 # @LIBRARY_NAME@ not found, explain to the user how to specify its location.
123 IF(NOT @LIBRARY_NAME@_FIND_QUIETLY)
124 MESSAGE(FATAL_ERROR ${@LIBRARY_NAME@_NOT_FOUND_MESSAGE})
125 ELSE(NOT @LIBRARY_NAME@_FIND_QUIETLY)
126 IF(@LIBRARY_NAME@_FIND_REQUIRED)
127 MESSAGE(FATAL_ERROR ${@LIBRARY_NAME@_NOT_FOUND_MESSAGE})
128 ENDIF(@LIBRARY_NAME@_FIND_REQUIRED)
129 ENDIF(NOT @LIBRARY_NAME@_FIND_QUIETLY)
130 ENDIF(NOT @LIBRARY_NAME@_FOUND)