# --------------------------------------------------------------------- # # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image # pour la Santé) # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton # Previous Authors : Laurent Guigues, Jean-Pierre Roux # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil # # This software is governed by the CeCILL-B license under French law and # abiding by the rules of distribution of free software. You can use, # modify and/ or redistribute the software under the terms of the CeCILL-B # license as circulated by CEA, CNRS and INRIA at the following URL # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html # or in the file LICENSE.txt. # # As a counterpart to the access to the source code and rights to copy, # modify and redistribute granted by the license, users are provided only # with a limited warranty and the software's author, the holder of the # economic rights, and the successive licensors have only limited # liability. # # The fact that you are presently reading this means that you have had # knowledge of the CeCILL-B license and that you accept its terms. # ------------------------------------------------------------------------ */ # - Find a library installation or build tree. # # The following variables are set if @LIBRARY_NAME@ is found. # If @LIBRARY_NAME@ is not found, @LIBRARY_NAME@_FOUND is set to false. # @LIBRARY_NAME@_FOUND - Set to true when @LIBRARY_NAME@ is found. # @LIBRARY_NAME@_USE_FILE - CMake file to use @LIBRARY_NAME@. # @LIBRARY_NAME@_MAJOR_VERSION - The @LIBRARY_NAME@ major version number. # @LIBRARY_NAME@_MINOR_VERSION - The @LIBRARY_NAME@ minor version number # (odd non-release). # @LIBRARY_NAME@_BUILD_VERSION - The @LIBRARY_NAME@ patch level # (meaningless for odd minor). # @LIBRARY_NAME@_INCLUDE_DIRS - Include directories for @LIBRARY_NAME@ # @LIBRARY_NAME@_LIBRARY_DIRS - Link directories for @LIBRARY_NAME@ libraries # @LIBRARY_NAME@_LIBRARIES - List of libraries to link against # # The following cache entries must be set by the user to locate @LIBRARY_NAME@: # @LIBRARY_NAME@_DIR - The directory containing @LIBRARY_NAME@Config.cmake. # This is either the root of the build tree, # or the lib/@LIBRARY_NAME@ directory. This is the # only cache entry. # Construct consitent error messages for use below. 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.") SET(@LIBRARY_NAME@_NOT_FOUND_MESSAGE "@LIBRARY_NAME@ not found. Set the @LIBRARY_NAME@_DIR cmake cache entry to the ${@LIBRARY_NAME@_DIR_DESCRIPTION}") # Search only if the location is not already known. IF(NOT @LIBRARY_NAME@_DIR) # Get the system search path as a list. IF(UNIX) STRING(REGEX MATCHALL "[^:]+" @LIBRARY_NAME@_DIR_SEARCH1 "$ENV{PATH}") ELSE(UNIX) STRING(REGEX REPLACE "\\\\" "/" @LIBRARY_NAME@_DIR_SEARCH1 "$ENV{PATH}") ENDIF(UNIX) STRING(REGEX REPLACE "/;" ";" @LIBRARY_NAME@_DIR_SEARCH2 "${@LIBRARY_NAME@_DIR_SEARCH1}") # Construct a set of paths relative to the system search path. SET(@LIBRARY_NAME@_DIR_SEARCH "") FOREACH(dir ${@LIBRARY_NAME@_DIR_SEARCH2}) SET(@LIBRARY_NAME@_DIR_SEARCH ${@LIBRARY_NAME@_DIR_SEARCH} ${dir}/../lib/@INSTALL_PATH@ ) ENDFOREACH(dir) # # Look for an installation or build tree. # FIND_PATH(@LIBRARY_NAME@_DIR Use@LIBRARY_NAME@.cmake # Look for an environment variable @LIBRARY_NAME@_DIR. $ENV{@LIBRARY_NAME@_DIR} # Look in places relative to the system executable search path. ${@LIBRARY_NAME@_DIR_SEARCH} # Look in standard WIN install locations. "$ENV{ProgramFiles}/@LIBRARY_NAME@" # Look in standard UNIX install locations. /usr/local/@INSTALL_PATH@ /usr/@INSTALL_PATH@ # Read from the CMakeSetup registry entries. It is likely that # @LIBRARY_NAME@ will have been recently built. [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild1] [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild2] [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild3] [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild4] [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild5] [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild6] [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild7] [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild8] [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild9] [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild10] # Help the user find it if we cannot. DOC "The ${@LIBRARY_NAME@_DIR_DESCRIPTION}" ) ENDIF(NOT @LIBRARY_NAME@_DIR) # If @LIBRARY_NAME@ was found, load the configuration file to get the rest of the # settings. IF(@LIBRARY_NAME@_DIR) # Make sure the @LIBRARY_NAME@Config.cmake file exists in the directory provided. IF(EXISTS ${@LIBRARY_NAME@_DIR}/@LIBRARY_NAME@Config.cmake) # We found @LIBRARY_NAME@. Load the settings. SET(@LIBRARY_NAME@_FOUND 1) INCLUDE(${@LIBRARY_NAME@_DIR}/@LIBRARY_NAME@Config.cmake) ENDIF(EXISTS ${@LIBRARY_NAME@_DIR}/@LIBRARY_NAME@Config.cmake) ELSE(@LIBRARY_NAME@_DIR) # We did not find @LIBRARY_NAME@. SET(@LIBRARY_NAME@_FOUND 0) ENDIF(@LIBRARY_NAME@_DIR) #----------------------------------------------------------------------------- IF(NOT @LIBRARY_NAME@_FOUND) # @LIBRARY_NAME@ not found, explain to the user how to specify its location. IF(NOT @LIBRARY_NAME@_FIND_QUIETLY) MESSAGE(FATAL_ERROR ${@LIBRARY_NAME@_NOT_FOUND_MESSAGE}) ELSE(NOT @LIBRARY_NAME@_FIND_QUIETLY) IF(@LIBRARY_NAME@_FIND_REQUIRED) MESSAGE(FATAL_ERROR ${@LIBRARY_NAME@_NOT_FOUND_MESSAGE}) ENDIF(@LIBRARY_NAME@_FIND_REQUIRED) ENDIF(NOT @LIBRARY_NAME@_FIND_QUIETLY) ENDIF(NOT @LIBRARY_NAME@_FOUND)