diff options
| author | Mark Young <marky@lunarg.com> | 2016-01-25 16:02:08 -0700 |
|---|---|---|
| committer | Mark Young <marky@lunarg.com> | 2016-01-25 16:04:01 -0700 |
| commit | 941707dd7ddbe7212691e5ae6f84c4aa8afa63ff (patch) | |
| tree | cbc6855d93dc1b83449bae257d1c76d9bfd6a0a1 | |
| parent | 0c347d9ee8a159832c6426c952c6b46dd92d0d57 (diff) | |
| download | usermoji-941707dd7ddbe7212691e5ae6f84c4aa8afa63ff.tar.xz | |
BUILD: Modified CMake ImageMagick detection logic to work with CMake 2.8.
Modified CMake ImageMagick detection logic to work with CMake 2.8.
| -rw-r--r-- | cmake/CMakeParseArguments.cmake | 161 | ||||
| -rw-r--r-- | cmake/Copyright_cmake.txt | 56 | ||||
| -rw-r--r-- | cmake/FindImageMagick.cmake | 296 | ||||
| -rw-r--r-- | cmake/FindPackageHandleStandardArgs.cmake | 442 | ||||
| -rw-r--r-- | cmake/FindPackageMessage.cmake | 59 | ||||
| -rw-r--r-- | cmake/README.txt | 9 |
6 files changed, 254 insertions, 769 deletions
diff --git a/cmake/CMakeParseArguments.cmake b/cmake/CMakeParseArguments.cmake deleted file mode 100644 index 8553f38f..00000000 --- a/cmake/CMakeParseArguments.cmake +++ /dev/null @@ -1,161 +0,0 @@ -#.rst: -# CMakeParseArguments -# ------------------- -# -# -# -# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> -# <multi_value_keywords> args...) -# -# CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions -# for parsing the arguments given to that macro or function. It -# processes the arguments and defines a set of variables which hold the -# values of the respective options. -# -# The <options> argument contains all options for the respective macro, -# i.e. keywords which can be used when calling the macro without any -# value following, like e.g. the OPTIONAL keyword of the install() -# command. -# -# The <one_value_keywords> argument contains all keywords for this macro -# which are followed by one value, like e.g. DESTINATION keyword of the -# install() command. -# -# The <multi_value_keywords> argument contains all keywords for this -# macro which can be followed by more than one value, like e.g. the -# TARGETS or FILES keywords of the install() command. -# -# When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the -# keywords listed in <options>, <one_value_keywords> and -# <multi_value_keywords> a variable composed of the given <prefix> -# followed by "_" and the name of the respective keyword. These -# variables will then hold the respective value from the argument list. -# For the <options> keywords this will be TRUE or FALSE. -# -# All remaining arguments are collected in a variable -# <prefix>_UNPARSED_ARGUMENTS, this can be checked afterwards to see -# whether your macro was called with unrecognized parameters. -# -# As an example here a my_install() macro, which takes similar arguments -# as the real install() command: -# -# :: -# -# function(MY_INSTALL) -# set(options OPTIONAL FAST) -# set(oneValueArgs DESTINATION RENAME) -# set(multiValueArgs TARGETS CONFIGURATIONS) -# cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" -# "${multiValueArgs}" ${ARGN} ) -# ... -# -# -# -# Assume my_install() has been called like this: -# -# :: -# -# my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub) -# -# -# -# After the cmake_parse_arguments() call the macro will have set the -# following variables: -# -# :: -# -# MY_INSTALL_OPTIONAL = TRUE -# MY_INSTALL_FAST = FALSE (this option was not used when calling my_install() -# MY_INSTALL_DESTINATION = "bin" -# MY_INSTALL_RENAME = "" (was not used) -# MY_INSTALL_TARGETS = "foo;bar" -# MY_INSTALL_CONFIGURATIONS = "" (was not used) -# MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL" -# -# -# -# You can then continue and process these variables. -# -# Keywords terminate lists of values, e.g. if directly after a -# one_value_keyword another recognized keyword follows, this is -# interpreted as the beginning of the new option. E.g. -# my_install(TARGETS foo DESTINATION OPTIONAL) would result in -# MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION -# would be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefor. - -#============================================================================= -# Copyright 2010 Alexander Neundorf <neundorf@kde.org> -# -# 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. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - - -if(__CMAKE_PARSE_ARGUMENTS_INCLUDED) - return() -endif() -set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE) - - -function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames) - # first set all result variables to empty/FALSE - foreach(arg_name ${_singleArgNames} ${_multiArgNames}) - set(${prefix}_${arg_name}) - endforeach() - - foreach(option ${_optionNames}) - set(${prefix}_${option} FALSE) - endforeach() - - set(${prefix}_UNPARSED_ARGUMENTS) - - set(insideValues FALSE) - set(currentArgName) - - # now iterate over all arguments and fill the result variables - foreach(currentArg ${ARGN}) - list(FIND _optionNames "${currentArg}" optionIndex) # ... then this marks the end of the arguments belonging to this keyword - list(FIND _singleArgNames "${currentArg}" singleArgIndex) # ... then this marks the end of the arguments belonging to this keyword - list(FIND _multiArgNames "${currentArg}" multiArgIndex) # ... then this marks the end of the arguments belonging to this keyword - - if(${optionIndex} EQUAL -1 AND ${singleArgIndex} EQUAL -1 AND ${multiArgIndex} EQUAL -1) - if(insideValues) - if("${insideValues}" STREQUAL "SINGLE") - set(${prefix}_${currentArgName} ${currentArg}) - set(insideValues FALSE) - elseif("${insideValues}" STREQUAL "MULTI") - list(APPEND ${prefix}_${currentArgName} ${currentArg}) - endif() - else() - list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg}) - endif() - else() - if(NOT ${optionIndex} EQUAL -1) - set(${prefix}_${currentArg} TRUE) - set(insideValues FALSE) - elseif(NOT ${singleArgIndex} EQUAL -1) - set(currentArgName ${currentArg}) - set(${prefix}_${currentArgName}) - set(insideValues "SINGLE") - elseif(NOT ${multiArgIndex} EQUAL -1) - set(currentArgName ${currentArg}) - set(${prefix}_${currentArgName}) - set(insideValues "MULTI") - endif() - endif() - - endforeach() - - # propagate the result variables to the caller: - foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames}) - set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE) - endforeach() - set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE) - -endfunction() diff --git a/cmake/Copyright_cmake.txt b/cmake/Copyright_cmake.txt new file mode 100644 index 00000000..35f7e4b6 --- /dev/null +++ b/cmake/Copyright_cmake.txt @@ -0,0 +1,56 @@ +CMake - Cross Platform Makefile Generator +Copyright 2000-2009 Kitware, Inc., Insight Software Consortium +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +* Neither the names of Kitware, Inc., the Insight Software Consortium, + nor the names of their contributors may be used to endorse or promote + products derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +------------------------------------------------------------------------------ + +The above copyright and license notice applies to distributions of +CMake in source and binary form. Some source files contain additional +notices of original copyright by their contributors; see each source +for details. Third-party software packages supplied with CMake under +compatible licenses provide their own copyright notices documented in +corresponding subdirectories. + +------------------------------------------------------------------------------ + +CMake was initially developed by Kitware with the following sponsorship: + + * National Library of Medicine at the National Institutes of Health + as part of the Insight Segmentation and Registration Toolkit (ITK). + + * US National Labs (Los Alamos, Livermore, Sandia) ASC Parallel + Visualization Initiative. + + * National Alliance for Medical Image Computing (NAMIC) is funded by the + National Institutes of Health through the NIH Roadmap for Medical Research, + Grant U54 EB005149. + + * Kitware, Inc. diff --git a/cmake/FindImageMagick.cmake b/cmake/FindImageMagick.cmake index f1552b1c..29cf600e 100644 --- a/cmake/FindImageMagick.cmake +++ b/cmake/FindImageMagick.cmake @@ -1,111 +1,81 @@ -#.rst: -# FindImageMagick -# --------------- -# -# Find the ImageMagick binary suite. -# -# This module will search for a set of ImageMagick tools specified as -# components in the FIND_PACKAGE call. Typical components include, but -# are not limited to (future versions of ImageMagick might have +# - Find the ImageMagick binary suite. +# This module will search for a set of ImageMagick tools specified +# as components in the FIND_PACKAGE call. Typical components include, +# but are not limited to (future versions of ImageMagick might have # additional components not listed here): # -# :: -# -# animate -# compare -# composite -# conjure -# convert -# display -# identify -# import -# mogrify -# montage -# stream -# -# +# animate +# compare +# composite +# conjure +# convert +# display +# identify +# import +# mogrify +# montage +# stream # # If no component is specified in the FIND_PACKAGE call, then it only -# searches for the ImageMagick executable directory. This code defines +# searches for the ImageMagick executable directory. This code defines # the following variables: # -# :: -# -# ImageMagick_FOUND - TRUE if all components are found. -# ImageMagick_EXECUTABLE_DIR - Full path to executables directory. -# ImageMagick_<component>_FOUND - TRUE if <component> is found. -# ImageMagick_<component>_EXECUTABLE - Full path to <component> executable. -# ImageMagick_VERSION_STRING - the version of ImageMagick found -# (since CMake 2.8.8) -# -# -# -# ImageMagick_VERSION_STRING will not work for old versions like 5.2.3. +# ImageMagick_FOUND - TRUE if all components are found. +# ImageMagick_EXECUTABLE_DIR - Full path to executables directory. +# ImageMagick_<component>_FOUND - TRUE if <component> is found. +# ImageMagick_<component>_EXECUTABLE - Full path to <component> executable. # # There are also components for the following ImageMagick APIs: # -# :: -# -# Magick++ -# MagickWand -# MagickCore -# -# +# Magick++ +# MagickWand +# MagickCore # # For these components the following variables are set: # -# :: -# -# ImageMagick_FOUND - TRUE if all components are found. -# ImageMagick_INCLUDE_DIRS - Full paths to all include dirs. -# ImageMagick_LIBRARIES - Full paths to all libraries. -# ImageMagick_<component>_FOUND - TRUE if <component> is found. -# ImageMagick_<component>_INCLUDE_DIRS - Full path to <component> include dirs. -# ImageMagick_<component>_LIBRARIES - Full path to <component> libraries. -# -# +# ImageMagick_FOUND - TRUE if all components are found. +# ImageMagick_INCLUDE_DIRS - Full paths to all include dirs. +# ImageMagick_LIBRARIES - Full paths to all libraries. +# ImageMagick_<component>_FOUND - TRUE if <component> is found. +# ImageMagick_<component>_INCLUDE_DIRS - Full path to <component> include dirs. +# ImageMagick_<component>_LIBRARIES - Full path to <component> libraries. # # Example Usages: +# FIND_PACKAGE(ImageMagick) +# FIND_PACKAGE(ImageMagick COMPONENTS convert) +# FIND_PACKAGE(ImageMagick COMPONENTS convert mogrify display) +# FIND_PACKAGE(ImageMagick COMPONENTS Magick++) +# FIND_PACKAGE(ImageMagick COMPONENTS Magick++ convert) # -# :: -# -# find_package(ImageMagick) -# find_package(ImageMagick COMPONENTS convert) -# find_package(ImageMagick COMPONENTS convert mogrify display) -# find_package(ImageMagick COMPONENTS Magick++) -# find_package(ImageMagick COMPONENTS Magick++ convert) -# -# -# -# Note that the standard FIND_PACKAGE features are supported (i.e., -# QUIET, REQUIRED, etc.). +# Note that the standard FIND_PACKAGE features are supported +# (i.e., QUIET, REQUIRED, etc.). #============================================================================= # Copyright 2007-2009 Kitware, Inc. # Copyright 2007-2008 Miguel A. Figueroa-Villanueva <miguelf at ieee dot org> -# Copyright 2012 Rolf Eike Beer <eike@sf-mail.de> # # Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. +# see accompanying file Copyright_cmake.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. #============================================================================= -# (To distribute this file outside of CMake, substitute the full +# (To distributed this file outside of CMake, substitute the full # License text for the above reference.) find_package(PkgConfig QUIET) function(FIND_REGISTRY) if (WIN32) + # If a 64-bit compile, it can only appear in "[HKLM]\\software\\ImageMagick" if (CMAKE_CL_64) GET_FILENAME_COMPONENT(IM_BIN_PATH [HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath] ABSOLUTE CACHE) - + else() # This is dumb, but it's the only way I've been able to get this to work. CMake has no knowledge of the systems architecture. @@ -139,7 +109,7 @@ function(FIND_REGISTRY) else() - message(WARNING "In FIND_REGISTRY: LINUX_BUILD") +# message(WARNING "In FIND_REGISTRY: LINUX_BUILD") set (IMAGEMAGIC_REG_PATH "" PARENT_SCOPE) set (IMAGEMAGIC_REGINCLUDE_PATH "" PARENT_SCOPE) set (IMAGEMAGIC_REGLIB_PATH "" PARENT_SCOPE) @@ -151,90 +121,54 @@ endfunction() #--------------------------------------------------------------------- # Helper functions #--------------------------------------------------------------------- -function(FIND_IMAGEMAGICK_API component header) - set(ImageMagick_${component}_FOUND FALSE PARENT_SCOPE) +FUNCTION(FIND_IMAGEMAGICK_API component header) + SET(ImageMagick_${component}_FOUND FALSE PARENT_SCOPE) - pkg_check_modules(PC_${component} QUIET ${component}) - - find_path(ImageMagick_${component}_INCLUDE_DIR + FIND_PATH(ImageMagick_${component}_INCLUDE_DIR NAMES ${header} - HINTS - ${IMAGEMAGIC_REGINCLUDE_PATH} - ${PC_${component}_INCLUDEDIR} - ${PC_${component}_INCLUDE_DIRS} - PATHS - ${ImageMagick_INCLUDE_DIRS} - ${IMAGEMAGIC_REGINCLUDE_PATH} - PATH_SUFFIXES - ImageMagick ImageMagick-6 - DOC "Path to the ImageMagick arch-independent include dir." - ) - find_path(ImageMagick_${component}_ARCH_INCLUDE_DIR - NAMES magick/magick-baseconfig.h - HINTS - ${IMAGEMAGIC_REGINCLUDE_PATH} - ${PC_${component}_INCLUDEDIR} - ${PC_${component}_INCLUDE_DIRS} PATHS ${ImageMagick_INCLUDE_DIRS} ${IMAGEMAGIC_REGINCLUDE_PATH} PATH_SUFFIXES - ImageMagick ImageMagick-6 - DOC "Path to the ImageMagick arch-specific include dir." + ImageMagick + DOC "Path to the ImageMagick include dir." ) - find_library(ImageMagick_${component}_LIBRARY + FIND_LIBRARY(ImageMagick_${component}_LIBRARY NAMES ${ARGN} - HINTS - ${IMAGEMAGIC_REGLIB_PATH} - ${PC_${component}_LIBDIR} - ${PC_${component}_LIB_DIRS} PATHS ${IMAGEMAGIC_REGLIB_PATH} DOC "Path to the ImageMagick Magick++ library." ) - # old version have only indep dir - if(ImageMagick_${component}_INCLUDE_DIR AND ImageMagick_${component}_LIBRARY) - set(ImageMagick_${component}_FOUND TRUE PARENT_SCOPE) + IF(ImageMagick_${component}_INCLUDE_DIR AND ImageMagick_${component}_LIBRARY) + SET(ImageMagick_${component}_FOUND TRUE PARENT_SCOPE) - # Construct per-component include directories. - set(ImageMagick_${component}_INCLUDE_DIRS + LIST(APPEND ImageMagick_INCLUDE_DIRS ${ImageMagick_${component}_INCLUDE_DIR} ) - if(ImageMagick_${component}_ARCH_INCLUDE_DIR) - list(APPEND ImageMagick_${component}_INCLUDE_DIRS - ${ImageMagick_${component}_ARCH_INCLUDE_DIR}) - endif() - list(REMOVE_DUPLICATES ImageMagick_${component}_INCLUDE_DIRS) - set(ImageMagick_${component}_INCLUDE_DIRS - ${ImageMagick_${component}_INCLUDE_DIRS} PARENT_SCOPE) + LIST(REMOVE_DUPLICATES ImageMagick_INCLUDE_DIRS) + SET(ImageMagick_INCLUDE_DIRS ${ImageMagick_INCLUDE_DIRS} PARENT_SCOPE) - # Add the per-component include directories to the full include dirs. - list(APPEND ImageMagick_INCLUDE_DIRS ${ImageMagick_${component}_INCLUDE_DIRS}) - list(REMOVE_DUPLICATES ImageMagick_INCLUDE_DIRS) - set(ImageMagick_INCLUDE_DIRS ${ImageMagick_INCLUDE_DIRS} PARENT_SCOPE) - - list(APPEND ImageMagick_LIBRARIES + LIST(APPEND ImageMagick_LIBRARIES ${ImageMagick_${component}_LIBRARY} ) - set(ImageMagick_LIBRARIES ${ImageMagick_LIBRARIES} PARENT_SCOPE) - endif() -endfunction() + SET(ImageMagick_LIBRARIES ${ImageMagick_LIBRARIES} PARENT_SCOPE) + ENDIF(ImageMagick_${component}_INCLUDE_DIR AND ImageMagick_${component}_LIBRARY) +ENDFUNCTION(FIND_IMAGEMAGICK_API) -function(FIND_IMAGEMAGICK_EXE component) - set(_IMAGEMAGICK_EXECUTABLE +FUNCTION(FIND_IMAGEMAGICK_EXE component) + SET(_IMAGEMAGICK_EXECUTABLE ${ImageMagick_EXECUTABLE_DIR}/${component}${CMAKE_EXECUTABLE_SUFFIX}) - - if(EXISTS ${_IMAGEMAGICK_EXECUTABLE}) - set(ImageMagick_${component}_EXECUTABLE + IF(EXISTS ${_IMAGEMAGICK_EXECUTABLE}) + SET(ImageMagick_${component}_EXECUTABLE ${_IMAGEMAGICK_EXECUTABLE} PARENT_SCOPE ) - set(ImageMagick_${component}_FOUND TRUE PARENT_SCOPE) - else() - set(ImageMagick_${component}_FOUND FALSE PARENT_SCOPE) - endif() -endfunction() + SET(ImageMagick_${component}_FOUND TRUE PARENT_SCOPE) + ELSE(EXISTS ${_IMAGEMAGICK_EXECUTABLE}) + SET(ImageMagick_${component}_FOUND FALSE PARENT_SCOPE) + ENDIF(EXISTS ${_IMAGEMAGICK_EXECUTABLE}) +ENDFUNCTION(FIND_IMAGEMAGICK_EXE) #--------------------------------------------------------------------- # Start Actual Work @@ -242,109 +176,81 @@ endfunction() FIND_REGISTRY() # Try to find a ImageMagick installation binary path. -find_path(ImageMagick_EXECUTABLE_DIR +FIND_PATH(ImageMagick_EXECUTABLE_DIR NAMES mogrify${CMAKE_EXECUTABLE_SUFFIX} PATHS ${IMAGEMAGIC_REG_PATH} DOC "Path to the ImageMagick binary directory." NO_DEFAULT_PATH ) -find_path(ImageMagick_EXECUTABLE_DIR +FIND_PATH(ImageMagick_EXECUTABLE_DIR NAMES mogrify${CMAKE_EXECUTABLE_SUFFIX} ) # Find each component. Search for all tools in same dir # <ImageMagick_EXECUTABLE_DIR>; otherwise they should be found # independently and not in a cohesive module such as this one. -unset(ImageMagick_REQUIRED_VARS) -unset(ImageMagick_DEFAULT_EXECUTABLES) -foreach(component ${ImageMagick_FIND_COMPONENTS} +SET(ImageMagick_FOUND TRUE) +FOREACH(component ${ImageMagick_FIND_COMPONENTS} # DEPRECATED: forced components for backward compatibility convert mogrify import montage composite ) - if(component STREQUAL "Magick++") + IF(component STREQUAL "Magick++") FIND_IMAGEMAGICK_API(Magick++ Magick++.h - Magick++ CORE_RL_Magick++_ Magick++-6.Q16 Magick++-Q16 Magick++-6.Q8 Magick++-Q8 Magick++-6.Q16HDRI Magick++-Q16HDRI Magick++-6.Q8HDRI Magick++-Q8HDRI + Magick++ CORE_RL_Magick++_ ) - list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_Magick++_LIBRARY) - elseif(component STREQUAL "MagickWand") + ELSEIF(component STREQUAL "MagickWand") FIND_IMAGEMAGICK_API(MagickWand wand/MagickWand.h - Wand MagickWand CORE_RL_wand_ MagickWand-6.Q16 MagickWand-Q16 MagickWand-6.Q8 MagickWand-Q8 MagickWand-6.Q16HDRI MagickWand-Q16HDRI MagickWand-6.Q8HDRI MagickWand-Q8HDRI + Wand MagickWand CORE_RL_wand_ ) - list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_MagickWand_LIBRARY) - elseif(component STREQUAL "MagickCore") + ELSEIF(component STREQUAL "MagickCore") FIND_IMAGEMAGICK_API(MagickCore magick/MagickCore.h - Magick MagickCore CORE_RL_magick_ MagickCore-6.Q16 MagickCore-Q16 MagickCore-6.Q8 MagickCore-Q8 MagickCore-6.Q16HDRI MagickCore-Q16HDRI MagickCore-6.Q8HDRI MagickCore-Q8HDRI + Magick MagickCore CORE_RL_magick_ ) - list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_MagickCore_LIBRARY) - else() - if(ImageMagick_EXECUTABLE_DIR) + ELSE(component STREQUAL "Magick++") + IF(ImageMagick_EXECUTABLE_DIR) FIND_IMAGEMAGICK_EXE(${component}) - endif() - - if(ImageMagick_FIND_COMPONENTS) - list(FIND ImageMagick_FIND_COMPONENTS ${component} is_requested) - if(is_requested GREATER -1) - list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_${component}_EXECUTABLE) - endif() - elseif(ImageMagick_${component}_EXECUTABLE) - # if no components were requested explicitly put all (default) executables - # in the list - list(APPEND ImageMagick_DEFAULT_EXECUTABLES ImageMagick_${component}_EXECUTABLE) - endif() - endif() -endforeach() - -if(NOT ImageMagick_FIND_COMPONENTS AND NOT ImageMagick_DEFAULT_EXECUTABLES) - # No components were requested, and none of the default components were - # found. Just insert mogrify into the list of the default components to - # find so FPHSA below has something to check - list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_mogrify_EXECUTABLE) -elseif(ImageMagick_DEFAULT_EXECUTABLES) - list(APPEND ImageMagick_REQUIRED_VARS ${ImageMagick_DEFAULT_EXECUTABLES}) -endif() - -set(ImageMagick_INCLUDE_DIRS ${ImageMagick_INCLUDE_DIRS}) -set(ImageMagick_LIBRARIES ${ImageMagick_LIBRARIES}) + ENDIF(ImageMagick_EXECUTABLE_DIR) + ENDIF(component STREQUAL "Magick++") + + IF(NOT ImageMagick_${component}_FOUND) + LIST(FIND ImageMagick_FIND_COMPONENTS ${component} is_requested) + IF(is_requested GREATER -1) + SET(ImageMagick_FOUND FALSE) + ENDIF(is_requested GREATER -1) + ENDIF(NOT ImageMagick_${component}_FOUND) +ENDFOREACH(component) -if(ImageMagick_mogrify_EXECUTABLE) - execute_process(COMMAND ${ImageMagick_mogrify_EXECUTABLE} -version - OUTPUT_VARIABLE imagemagick_version - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - if(imagemagick_version MATCHES "^Version: ImageMagick ([-0-9\\.]+)") - set(ImageMagick_VERSION_STRING "${CMAKE_MATCH_1}") - endif() - unset(imagemagick_version) -endif() +SET(ImageMagick_INCLUDE_DIRS ${ImageMagick_INCLUDE_DIRS}) +SET(ImageMagick_LIBRARIES ${ImageMagick_LIBRARIES}) #--------------------------------------------------------------------- # Standard Package Output #--------------------------------------------------------------------- -include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(ImageMagick - REQUIRED_VARS ${ImageMagick_REQUIRED_VARS} - VERSION_VAR ImageMagick_VERSION_STRING +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS( + ImageMagick DEFAULT_MSG ImageMagick_FOUND ) # Maintain consistency with all other variables. -set(ImageMagick_FOUND ${IMAGEMAGICK_FOUND}) +SET(ImageMagick_FOUND ${IMAGEMAGICK_FOUND}) #--------------------------------------------------------------------- # DEPRECATED: Setting variables for backward compatibility. #--------------------------------------------------------------------- -set(IMAGEMAGICK_BINARY_PATH ${ImageMagick_EXECUTABLE_DIR} +SET(IMAGEMAGICK_BINARY_PATH ${ImageMagick_EXECUTABLE_DIR} CACHE PATH "Path to the ImageMagick binary directory.") -set(IMAGEMAGICK_CONVERT_EXECUTABLE ${ImageMagick_convert_EXECUTABLE} +SET(IMAGEMAGICK_CONVERT_EXECUTABLE ${ImageMagick_convert_EXECUTABLE} CACHE FILEPATH "Path to ImageMagick's convert executable.") -set(IMAGEMAGICK_MOGRIFY_EXECUTABLE ${ImageMagick_mogrify_EXECUTABLE} +SET(IMAGEMAGICK_MOGRIFY_EXECUTABLE ${ImageMagick_mogrify_EXECUTABLE} CACHE FILEPATH "Path to ImageMagick's mogrify executable.") -set(IMAGEMAGICK_IMPORT_EXECUTABLE ${ImageMagick_import_EXECUTABLE} +SET(IMAGEMAGICK_IMPORT_EXECUTABLE ${ImageMagick_import_EXECUTABLE} CACHE FILEPATH "Path to ImageMagick's import executable.") -set(IMAGEMAGICK_MONTAGE_EXECUTABLE ${ImageMagick_montage_EXECUTABLE} +SET(IMAGEMAGICK_MONTAGE_EXECUTABLE ${ImageMagick_montage_EXECUTABLE} CACHE FILEPATH "Path to ImageMagick's montage executable.") -set(IMAGEMAGICK_COMPOSITE_EXECUTABLE ${ImageMagick_composite_EXECUTABLE} +SET(IMAGEMAGICK_COMPOSITE_EXECUTABLE ${ImageMagick_composite_EXECUTABLE} CACHE FILEPATH "Path to ImageMagick's composite executable.") -mark_as_advanced( + +MARK_AS_ADVANCED( IMAGEMAGICK_BINARY_PATH IMAGEMAGICK_CONVERT_EXECUTABLE IMAGEMAGICK_MOGRIFY_EXECUTABLE diff --git a/cmake/FindPackageHandleStandardArgs.cmake b/cmake/FindPackageHandleStandardArgs.cmake index fe2dbeaa..a64fb426 100644 --- a/cmake/FindPackageHandleStandardArgs.cmake +++ b/cmake/FindPackageHandleStandardArgs.cmake @@ -1,396 +1,80 @@ -#[=======================================================================[.rst: -FindPackageHandleStandardArgs ------------------------------ - -This module provides a function intended to be used in :ref:`Find Modules` -implementing :command:`find_package(<PackageName>)` calls. It handles the -``REQUIRED``, ``QUIET`` and version-related arguments of ``find_package``. -It also sets the ``<PackageName>_FOUND`` variable. The package is -considered found if all variables listed contain valid results, e.g. -valid filepaths. - -.. command:: find_package_handle_standard_args - - There are two signatures:: - - find_package_handle_standard_args(<PackageName> - (DEFAULT_MSG|<custom-failure-message>) - <required-var>... - ) - - find_package_handle_standard_args(<PackageName> - [FOUND_VAR <result-var>] - [REQUIRED_VARS <required-var>...] - [VERSION_VAR <version-var>] - [HANDLE_COMPONENTS] - [CONFIG_MODE] - [FAIL_MESSAGE <custom-failure-message>] - ) - - The ``<PackageName>_FOUND`` variable will be set to ``TRUE`` if all - the variables ``<required-var>...`` are valid and any optional - constraints are satisfied, and ``FALSE`` otherwise. A success or - failure message may be displayed based on the results and on - whether the ``REQUIRED`` and/or ``QUIET`` option was given to - the :command:`find_package` call. - - The options are: - - ``(DEFAULT_MSG|<custom-failure-message>)`` - In the simple signature this specifies the failure message. - Use ``DEFAULT_MSG`` to ask for a default message to be computed - (recommended). Not valid in the full signature. - - ``FOUND_VAR <result-var>`` - Obsolete. Specifies either ``<PackageName>_FOUND`` or - ``<PACKAGENAME>_FOUND`` as the result variable. This exists only - for compatibility with older versions of CMake and is now ignored. - Result variables of both names are always set for compatibility. - - ``REQUIRED_VARS <required-var>...`` - Specify the variables which are required for this package. - These may be named in the generated failure message asking the - user to set the missing variable values. Therefore these should - typically be cache entries such as ``FOO_LIBRARY`` and not output - variables like ``FOO_LIBRARIES``. - - ``VERSION_VAR <version-var>`` - Specify the name of a variable that holds the version of the package - that has been found. This version will be checked against the - (potentially) specified required version given to the - :command:`find_package` call, including its ``EXACT`` option. - The default messages include information about the required - version and the version which has been actually found, both - if the version is ok or not. - - ``HANDLE_COMPONENTS`` - Enable handling of package components. In this case, the command - will report which components have been found and which are missing, - and the ``<PackageName>_FOUND`` variable will be set to ``FALSE`` - if any of the required components (i.e. not the ones listed after - the ``OPTIONAL_COMPONENTS`` option of :command:`find_package`) are - missing. - - ``CONFIG_MODE`` - Specify that the calling find module is a wrapper around a - call to ``find_package(<PackageName> NO_MODULE)``. This implies - a ``VERSION_VAR`` value of ``<PackageName>_VERSION``. The command - will automatically check whether the package configuration file - was found. - - ``FAIL_MESSAGE <custom-failure-message>`` - Specify a custom failure message instead of using the default - generated message. Not recommended. - -Example for the simple signature: - -.. code-block:: cmake - - find_package_handle_standard_args(LibXml2 DEFAULT_MSG - LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR) - -The ``LibXml2`` package is considered to be found if both -``LIBXML2_LIBRARY`` and ``LIBXML2_INCLUDE_DIR`` are valid. -Then also ``LibXml2_FOUND`` is set to ``TRUE``. If it is not found -and ``REQUIRED`` was used, it fails with a -:command:`message(FATAL_ERROR)`, independent whether ``QUIET`` was -used or not. If it is found, success will be reported, including -the content of the first ``<required-var>``. On repeated CMake runs, -the same message will not be printed again. - -Example for the full signature: - -.. code-block:: cmake - - find_package_handle_standard_args(LibArchive - REQUIRED_VARS LibArchive_LIBRARY LibArchive_INCLUDE_DIR - VERSION_VAR LibArchive_VERSION) - -In this case, the ``LibArchive`` package is considered to be found if -both ``LibArchive_LIBRARY`` and ``LibArchive_INCLUDE_DIR`` are valid. -Also the version of ``LibArchive`` will be checked by using the version -contained in ``LibArchive_VERSION``. Since no ``FAIL_MESSAGE`` is given, -the default messages will be printed. - -Another example for the full signature: - -.. code-block:: cmake - - find_package(Automoc4 QUIET NO_MODULE HINTS /opt/automoc4) - find_package_handle_standard_args(Automoc4 CONFIG_MODE) - -In this case, a ``FindAutmoc4.cmake`` module wraps a call to -``find_package(Automoc4 NO_MODULE)`` and adds an additional search -directory for ``automoc4``. Then the call to -``find_package_handle_standard_args`` produces a proper success/failure -message. -#]=======================================================================] +# FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME (DEFAULT_MSG|"Custom failure message") VAR1 ... ) +# This macro is intended to be used in FindXXX.cmake modules files. +# It handles the REQUIRED and QUIET argument to FIND_PACKAGE() and +# it also sets the <UPPERCASED_NAME>_FOUND variable. +# The package is found if all variables listed are TRUE. +# Example: +# +# FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR) +# +# LibXml2 is considered to be found, if both LIBXML2_LIBRARIES and +# LIBXML2_INCLUDE_DIR are valid. Then also LIBXML2_FOUND is set to TRUE. +# If it is not found and REQUIRED was used, it fails with FATAL_ERROR, +# independent whether QUIET was used or not. +# If it is found, the location is reported using the VAR1 argument, so +# here a message "Found LibXml2: /usr/lib/libxml2.so" will be printed out. +# If the second argument is DEFAULT_MSG, the message in the failure case will +# be "Could NOT find LibXml2", if you don't like this message you can specify +# your own custom failure message there. #============================================================================= # Copyright 2007-2009 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. +# see accompanying file Copyright_cmake.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. #============================================================================= -# (To distribute this file outside of CMake, substitute the full +# (To distributed this file outside of CMake, substitute the full # License text for the above reference.) -include(${CMAKE_CURRENT_LIST_DIR}/FindPackageMessage.cmake) -include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake) - -# internal helper macro -macro(_FPHSA_FAILURE_MESSAGE _msg) - if (${_NAME}_FIND_REQUIRED) - message(FATAL_ERROR "${_msg}") - else () - if (NOT ${_NAME}_FIND_QUIETLY) - message(STATUS "${_msg}") - endif () - endif () -endmacro() - - -# internal helper macro to generate the failure message when used in CONFIG_MODE: -macro(_FPHSA_HANDLE_FAILURE_CONFIG_MODE) - # <name>_CONFIG is set, but FOUND is false, this means that some other of the REQUIRED_VARS was not found: - if(${_NAME}_CONFIG) - _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: missing: ${MISSING_VARS} (found ${${_NAME}_CONFIG} ${VERSION_MSG})") - else() - # If _CONSIDERED_CONFIGS is set, the config-file has been found, but no suitable version. - # List them all in the error message: - if(${_NAME}_CONSIDERED_CONFIGS) - set(configsText "") - list(LENGTH ${_NAME}_CONSIDERED_CONFIGS configsCount) - math(EXPR configsCount "${configsCount} - 1") - foreach(currentConfigIndex RANGE ${configsCount}) - list(GET ${_NAME}_CONSIDERED_CONFIGS ${currentConfigIndex} filename) - list(GET ${_NAME}_CONSIDERED_VERSIONS ${currentConfigIndex} version) - set(configsText "${configsText} ${filename} (version ${version})\n") - endforeach() - if (${_NAME}_NOT_FOUND_MESSAGE) - set(configsText "${configsText} Reason given by package: ${${_NAME}_NOT_FOUND_MESSAGE}\n") - endif() - _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} ${VERSION_MSG}, checked the following files:\n${configsText}") - - else() - # Simple case: No Config-file was found at all: - _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: found neither ${_NAME}Config.cmake nor ${_NAME_LOWER}-config.cmake ${VERSION_MSG}") - endif() - endif() -endmacro() - +INCLUDE(FindPackageMessage) +FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FAIL_MSG _VAR1 ) -function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) + IF("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG") + SET(_FAIL_MESSAGE "Could NOT find ${_NAME}") + ELSE("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG") + SET(_FAIL_MESSAGE "${_FAIL_MSG}") + ENDIF("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG") -# set up the arguments for CMAKE_PARSE_ARGUMENTS and check whether we are in -# new extended or in the "old" mode: - set(options CONFIG_MODE HANDLE_COMPONENTS) - set(oneValueArgs FAIL_MESSAGE VERSION_VAR FOUND_VAR) - set(multiValueArgs REQUIRED_VARS) - set(_KEYWORDS_FOR_EXTENDED_MODE ${options} ${oneValueArgs} ${multiValueArgs} ) - list(FIND _KEYWORDS_FOR_EXTENDED_MODE "${_FIRST_ARG}" INDEX) + STRING(TOUPPER ${_NAME} _NAME_UPPER) - if(${INDEX} EQUAL -1) - set(FPHSA_FAIL_MESSAGE ${_FIRST_ARG}) - set(FPHSA_REQUIRED_VARS ${ARGN}) - set(FPHSA_VERSION_VAR) - else() - - CMAKE_PARSE_ARGUMENTS(FPHSA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN}) - - if(FPHSA_UNPARSED_ARGUMENTS) - message(FATAL_ERROR "Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): \"${FPHSA_UNPARSED_ARGUMENTS}\"") - endif() - - if(NOT FPHSA_FAIL_MESSAGE) - set(FPHSA_FAIL_MESSAGE "DEFAULT_MSG") - endif() - endif() - -# now that we collected all arguments, process them - - if("x${FPHSA_FAIL_MESSAGE}" STREQUAL "xDEFAULT_MSG") - set(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}") - endif() - - # In config-mode, we rely on the variable <package>_CONFIG, which is set by find_package() - # when it successfully found the config-file, including version checking: - if(FPHSA_CONFIG_MODE) - list(INSERT FPHSA_REQUIRED_VARS 0 ${_NAME}_CONFIG) - list(REMOVE_DUPLICATES FPHSA_REQUIRED_VARS) - set(FPHSA_VERSION_VAR ${_NAME}_VERSION) - endif() - - if(NOT FPHSA_REQUIRED_VARS) - message(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()") - endif() - - list(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR) - - string(TOUPPER ${_NAME} _NAME_UPPER) - string(TOLOWER ${_NAME} _NAME_LOWER) - - if(FPHSA_FOUND_VAR) - if(FPHSA_FOUND_VAR MATCHES "^${_NAME}_FOUND$" OR FPHSA_FOUND_VAR MATCHES "^${_NAME_UPPER}_FOUND$") - set(_FOUND_VAR ${FPHSA_FOUND_VAR}) - else() - message(FATAL_ERROR "The argument for FOUND_VAR is \"${FPHSA_FOUND_VAR}\", but only \"${_NAME}_FOUND\" and \"${_NAME_UPPER}_FOUND\" are valid names.") - endif() - else() - set(_FOUND_VAR ${_NAME_UPPER}_FOUND) - endif() - - # collect all variables which were not found, so they can be printed, so the + # collect all variables which were not found, so they can be printed, so the # user knows better what went wrong (#6375) - set(MISSING_VARS "") - set(DETAILS "") - # check if all passed variables are valid - set(FPHSA_FOUND_${_NAME} TRUE) - foreach(_CURRENT_VAR ${FPHSA_REQUIRED_VARS}) - if(NOT ${_CURRENT_VAR}) - set(FPHSA_FOUND_${_NAME} FALSE) - set(MISSING_VARS "${MISSING_VARS} ${_CURRENT_VAR}") - else() - set(DETAILS "${DETAILS}[${${_CURRENT_VAR}}]") - endif() - endforeach() - if(FPHSA_FOUND_${_NAME}) - set(${_NAME}_FOUND TRUE) - set(${_NAME_UPPER}_FOUND TRUE) - else() - set(${_NAME}_FOUND FALSE) - set(${_NAME_UPPER}_FOUND FALSE) - endif() - - # component handling - unset(FOUND_COMPONENTS_MSG) - unset(MISSING_COMPONENTS_MSG) - - if(FPHSA_HANDLE_COMPONENTS) - foreach(comp ${${_NAME}_FIND_COMPONENTS}) - if(${_NAME}_${comp}_FOUND) - - if(NOT DEFINED FOUND_COMPONENTS_MSG) - set(FOUND_COMPONENTS_MSG "found components: ") - endif() - set(FOUND_COMPONENTS_MSG "${FOUND_COMPONENTS_MSG} ${comp}") - - else() + SET(MISSING_VARS "") + SET(DETAILS "") + SET(${_NAME_UPPER}_FOUND TRUE) + IF(NOT ${_VAR1}) + SET(${_NAME_UPPER}_FOUND FALSE) + SET(MISSING_VARS " ${_VAR1}") + ELSE(NOT ${_VAR1}) + SET(DETAILS "${DETAILS}[${${_VAR1}}]") + ENDIF(NOT ${_VAR1}) - if(NOT DEFINED MISSING_COMPONENTS_MSG) - set(MISSING_COMPONENTS_MSG "missing components: ") - endif() - set(MISSING_COMPONENTS_MSG "${MISSING_COMPONENTS_MSG} ${comp}") - - if(${_NAME}_FIND_REQUIRED_${comp}) - set(${_NAME}_FOUND FALSE) - set(MISSING_VARS "${MISSING_VARS} ${comp}") - endif() - - endif() - endforeach() - set(COMPONENT_MSG "${FOUND_COMPONENTS_MSG} ${MISSING_COMPONENTS_MSG}") - set(DETAILS "${DETAILS}[c${COMPONENT_MSG}]") - endif() - - # version handling: - set(VERSION_MSG "") - set(VERSION_OK TRUE) - set(VERSION ${${FPHSA_VERSION_VAR}}) - - # check with DEFINED here as the requested or found version may be "0" - if (DEFINED ${_NAME}_FIND_VERSION) - if(DEFINED ${FPHSA_VERSION_VAR}) - - if(${_NAME}_FIND_VERSION_EXACT) # exact version required - # count the dots in the version string - string(REGEX REPLACE "[^.]" "" _VERSION_DOTS "${VERSION}") - # add one dot because there is one dot more than there are components - string(LENGTH "${_VERSION_DOTS}." _VERSION_DOTS) - if (_VERSION_DOTS GREATER ${_NAME}_FIND_VERSION_COUNT) - # Because of the C++ implementation of find_package() ${_NAME}_FIND_VERSION_COUNT - # is at most 4 here. Therefore a simple lookup table is used. - if (${_NAME}_FIND_VERSION_COUNT EQUAL 1) - set(_VERSION_REGEX "[^.]*") - elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 2) - set(_VERSION_REGEX "[^.]*\\.[^.]*") - elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 3) - set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*") - else () - set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*\\.[^.]*") - endif () - string(REGEX REPLACE "^(${_VERSION_REGEX})\\..*" "\\1" _VERSION_HEAD "${VERSION}") - unset(_VERSION_REGEX) - if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL _VERSION_HEAD) - set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"") - set(VERSION_OK FALSE) - else () - set(VERSION_MSG "(found suitable exact version \"${VERSION}\")") - endif () - unset(_VERSION_HEAD) - else () - if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL VERSION) - set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"") - set(VERSION_OK FALSE) - else () - set(VERSION_MSG "(found suitable exact version \"${VERSION}\")") - endif () - endif () - unset(_VERSION_DOTS) - - else() # minimum version specified: - if (${_NAME}_FIND_VERSION VERSION_GREATER VERSION) - set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is at least \"${${_NAME}_FIND_VERSION}\"") - set(VERSION_OK FALSE) - else () - set(VERSION_MSG "(found suitable version \"${VERSION}\", minimum required is \"${${_NAME}_FIND_VERSION}\")") - endif () - endif() - - else() - - # if the package was not found, but a version was given, add that to the output: - if(${_NAME}_FIND_VERSION_EXACT) - set(VERSION_MSG "(Required is exact version \"${${_NAME}_FIND_VERSION}\")") - else() - set(VERSION_MSG "(Required is at least version \"${${_NAME}_FIND_VERSION}\")") - endif() - - endif() - else () - if(VERSION) - set(VERSION_MSG "(found version \"${VERSION}\")") - endif() - endif () - - if(VERSION_OK) - set(DETAILS "${DETAILS}[v${VERSION}(${${_NAME}_FIND_VERSION})]") - else() - set(${_NAME}_FOUND FALSE) - endif() - - - # print the result: - if (${_NAME}_FOUND) - FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG} ${COMPONENT_MSG}" "${DETAILS}") - else () - - if(FPHSA_CONFIG_MODE) - _FPHSA_HANDLE_FAILURE_CONFIG_MODE() - else() - if(NOT VERSION_OK) - _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})") - else() - _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} (missing: ${MISSING_VARS}) ${VERSION_MSG}") - endif() - endif() - - endif () - - set(${_NAME}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE) - set(${_NAME_UPPER}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE) -endfunction() + # check if all passed variables are valid + FOREACH(_CURRENT_VAR ${ARGN}) + IF(NOT ${_CURRENT_VAR}) + SET(${_NAME_UPPER}_FOUND FALSE) + SET(MISSING_VARS "${MISSING_VARS} ${_CURRENT_VAR}") + ELSE(NOT ${_CURRENT_VAR}) + SET(DETAILS "${DETAILS}[${${_CURRENT_VAR}}]") + ENDIF(NOT ${_CURRENT_VAR}) + ENDFOREACH(_CURRENT_VAR) + + IF (${_NAME_UPPER}_FOUND) + FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_VAR1}}" "${DETAILS}") + ELSE (${_NAME_UPPER}_FOUND) + IF (${_NAME}_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "${_FAIL_MESSAGE} (missing: ${MISSING_VARS})") + ELSE (${_NAME}_FIND_REQUIRED) + IF (NOT ${_NAME}_FIND_QUIETLY) + MESSAGE(STATUS "${_FAIL_MESSAGE} (missing: ${MISSING_VARS})") + ENDIF (NOT ${_NAME}_FIND_QUIETLY) + ENDIF (${_NAME}_FIND_REQUIRED) + ENDIF (${_NAME_UPPER}_FOUND) + + SET(${_NAME_UPPER}_FOUND ${${_NAME_UPPER}_FOUND} PARENT_SCOPE) + +ENDFUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS) diff --git a/cmake/FindPackageMessage.cmake b/cmake/FindPackageMessage.cmake index a0349d3d..fe43eec9 100644 --- a/cmake/FindPackageMessage.cmake +++ b/cmake/FindPackageMessage.cmake @@ -1,57 +1,48 @@ -#.rst: -# FindPackageMessage -# ------------------ -# -# -# # FIND_PACKAGE_MESSAGE(<name> "message for user" "find result details") # -# This macro is intended to be used in FindXXX.cmake modules files. It -# will print a message once for each unique find result. This is useful -# for telling the user where a package was found. The first argument -# specifies the name (XXX) of the package. The second argument -# specifies the message to display. The third argument lists details -# about the find result so that if they change the message will be -# displayed again. The macro also obeys the QUIET argument to the -# find_package command. +# This macro is intended to be used in FindXXX.cmake modules files. +# It will print a message once for each unique find result. +# This is useful for telling the user where a package was found. +# The first argument specifies the name (XXX) of the package. +# The second argument specifies the message to display. +# The third argument lists details about the find result so that +# if they change the message will be displayed again. +# The macro also obeys the QUIET argument to the find_package command. # # Example: # -# :: -# -# if(X11_FOUND) -# FIND_PACKAGE_MESSAGE(X11 "Found X11: ${X11_X11_LIB}" -# "[${X11_X11_LIB}][${X11_INCLUDE_DIR}]") -# else() -# ... -# endif() +# IF(X11_FOUND) +# FIND_PACKAGE_MESSAGE(X11 "Found X11: ${X11_X11_LIB}" +# "[${X11_X11_LIB}][${X11_INCLUDE_DIR}]") +# ELSE(X11_FOUND) +# ... +# ENDIF(X11_FOUND) #============================================================================= # Copyright 2008-2009 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. +# see accompanying file Copyright_cmake.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. #============================================================================= -# (To distribute this file outside of CMake, substitute the full +# (To distributed this file outside of CMake, substitute the full # License text for the above reference.) -function(FIND_PACKAGE_MESSAGE pkg msg details) +FUNCTION(FIND_PACKAGE_MESSAGE pkg msg details) # Avoid printing a message repeatedly for the same find result. - if(NOT ${pkg}_FIND_QUIETLY) - string(REPLACE "\n" "" details "${details}") - set(DETAILS_VAR FIND_PACKAGE_MESSAGE_DETAILS_${pkg}) - if(NOT "${details}" STREQUAL "${${DETAILS_VAR}}") + IF(NOT ${pkg}_FIND_QUIETLY) + SET(DETAILS_VAR FIND_PACKAGE_MESSAGE_DETAILS_${pkg}) + IF(NOT "${details}" STREQUAL "${${DETAILS_VAR}}") # The message has not yet been printed. - message(STATUS "${msg}") + MESSAGE(STATUS "${msg}") # Save the find details in the cache to avoid printing the same # message again. - set("${DETAILS_VAR}" "${details}" + SET("${DETAILS_VAR}" "${details}" CACHE INTERNAL "Details about finding ${pkg}") - endif() - endif() -endfunction() + ENDIF(NOT "${details}" STREQUAL "${${DETAILS_VAR}}") + ENDIF(NOT ${pkg}_FIND_QUIETLY) +ENDFUNCTION(FIND_PACKAGE_MESSAGE) diff --git a/cmake/README.txt b/cmake/README.txt new file mode 100644 index 00000000..ddad8fa1 --- /dev/null +++ b/cmake/README.txt @@ -0,0 +1,9 @@ +The following files are copied out of CMake 2.8. +- FindImageMagick.cmake +- FindPackageHandleStandardArgs.cmake +- FindPackageMessage.cmake + +I have also copied the Copyright.txt file out of cmake and renamed it: +- Copyright_cmake.txt + +All other files are created and/or maintained by either LunarG Inc or Valve Corporation.
\ No newline at end of file |
