diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindBISON.cmake | 5 | ||||
-rw-r--r-- | Modules/FindCURL.cmake | 13 | ||||
-rw-r--r-- | Modules/FindGnuplot.cmake | 16 | ||||
-rw-r--r-- | Modules/FindImageMagick.cmake | 52 | ||||
-rw-r--r-- | Modules/FindJasper.cmake | 2 | ||||
-rw-r--r-- | Modules/FindLibXml2.cmake | 17 | ||||
-rw-r--r-- | Modules/FindLua51.cmake | 14 | ||||
-rw-r--r-- | Modules/FindOpenSSL.cmake | 40 | ||||
-rw-r--r-- | Modules/FindPNG.cmake | 11 | ||||
-rw-r--r-- | Modules/FindPostgreSQL.cmake | 32 | ||||
-rw-r--r-- | Modules/FindPythonInterp.cmake | 17 | ||||
-rw-r--r-- | Modules/FindRuby.cmake | 19 | ||||
-rw-r--r-- | Modules/FindTCL.cmake | 12 | ||||
-rw-r--r-- | Modules/FindTIFF.cmake | 13 | ||||
-rw-r--r-- | Modules/FindTclsh.cmake | 12 | ||||
-rw-r--r-- | Modules/SelectLibraryConfigurations.cmake | 7 |
16 files changed, 215 insertions, 67 deletions
diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake index edde9eb..7af3367 100644 --- a/Modules/FindBISON.cmake +++ b/Modules/FindBISON.cmake @@ -75,8 +75,9 @@ IF(BISON_EXECUTABLE) ELSEIF("${BISON_version_output}" MATCHES "^bison[^+]") STRING(REGEX REPLACE "^bison \\(GNU Bison\\) ([^\n]+)\n.*" "\\1" BISON_VERSION "${BISON_version_output}") - ELSE() - SET(BISON_VERSION "unknown") + ELSEIF("${BISON_version_output}" MATCHES "^GNU Bison ") + STRING(REGEX REPLACE "^GNU Bison (version )?([^\n]+).*" "\\2" + BISON_VERSION "${BISON_version_output}") ENDIF() ENDIF() diff --git a/Modules/FindCURL.cmake b/Modules/FindCURL.cmake index 517638a..cc00d53 100644 --- a/Modules/FindCURL.cmake +++ b/Modules/FindCURL.cmake @@ -34,11 +34,16 @@ FIND_LIBRARY(CURL_LIBRARY NAMES ) MARK_AS_ADVANCED(CURL_LIBRARY) -IF(CURL_INCLUDE_DIR AND EXISTS "${CURL_INCLUDE_DIR}/curl/curlver.h") - FILE(STRINGS "${CURL_INCLUDE_DIR}/curl/curlver.h" curl_version_str REGEX "^#define[\t ]+LIBCURL_VERSION[\t ]+\".*\"") +IF(CURL_INCLUDE_DIR) + FOREACH(_curl_version_header curlver.h curl.h) + IF(EXISTS "${CURL_INCLUDE_DIR}/curl/${_curl_version_header}") + FILE(STRINGS "${CURL_INCLUDE_DIR}/curl/${_curl_version_header}" curl_version_str REGEX "^#define[\t ]+LIBCURL_VERSION[\t ]+\".*\"") - STRING(REGEX REPLACE "^#define[\t ]+LIBCURL_VERSION[\t ]+\"([^\"]*)\".*" "\\1" CURL_VERSION_STRING "${curl_version_str}") - UNSET(curl_version_str) + STRING(REGEX REPLACE "^#define[\t ]+LIBCURL_VERSION[\t ]+\"([^\"]*)\".*" "\\1" CURL_VERSION_STRING "${curl_version_str}") + UNSET(curl_version_str) + BREAK() + ENDIF() + ENDFOREACH(_curl_version_header) ENDIF() # handle the QUIETLY and REQUIRED arguments and set CURL_FOUND to TRUE if diff --git a/Modules/FindGnuplot.cmake b/Modules/FindGnuplot.cmake index 7c59f03..3e36e4b 100644 --- a/Modules/FindGnuplot.cmake +++ b/Modules/FindGnuplot.cmake @@ -4,6 +4,7 @@ # # GNUPLOT_FOUND - system has Gnuplot # GNUPLOT_EXECUTABLE - the Gnuplot executable +# GNUPLOT_VERSION_STRING - the version of Gnuplot found (since CMake 2.8.8) #============================================================================= # Copyright 2002-2009 Kitware, Inc. @@ -29,13 +30,26 @@ FIND_PROGRAM(GNUPLOT_EXECUTABLE ${CYGWIN_INSTALL_PATH}/bin ) +IF (GNUPLOT_EXECUTABLE) + EXECUTE_PROCESS(COMMAND "${GNUPLOT_EXECUTABLE}" --version + OUTPUT_VARIABLE GNUPLOT_OUTPUT_VARIABLE + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + + STRING(REGEX REPLACE "^gnuplot ([0-9\\.]+)( patchlevel )?" "\\1." GNUPLOT_VERSION_STRING "${GNUPLOT_OUTPUT_VARIABLE}") + STRING(REGEX REPLACE "\\.$" "" GNUPLOT_VERSION_STRING "${GNUPLOT_VERSION_STRING}") + UNSET(GNUPLOT_OUTPUT_VARIABLE) +ENDIF() + # for compatibility SET(GNUPLOT ${GNUPLOT_EXECUTABLE}) # handle the QUIETLY and REQUIRED arguments and set GNUPLOT_FOUND to TRUE if # all listed variables are TRUE INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gnuplot DEFAULT_MSG GNUPLOT_EXECUTABLE) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gnuplot + REQUIRED_VARS GNUPLOT_EXECUTABLE + VERSION_VAR GNUPLOT_VERSION_STRING) MARK_AS_ADVANCED( GNUPLOT_EXECUTABLE ) diff --git a/Modules/FindImageMagick.cmake b/Modules/FindImageMagick.cmake index 5e6fa20..75523f4 100644 --- a/Modules/FindImageMagick.cmake +++ b/Modules/FindImageMagick.cmake @@ -24,6 +24,8 @@ # 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) # # There are also components for the following ImageMagick APIs: # @@ -53,6 +55,7 @@ #============================================================================= # 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. @@ -134,7 +137,8 @@ FIND_PATH(ImageMagick_EXECUTABLE_DIR # 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. -SET(ImageMagick_FOUND TRUE) +UNSET(ImageMagick_REQUIRED_VARS) +UNSET(ImageMagick_DEFAULT_EXECUTABLES) FOREACH(component ${ImageMagick_FIND_COMPONENTS} # DEPRECATED: forced components for backward compatibility convert mogrify import montage composite @@ -143,37 +147,65 @@ FOREACH(component ${ImageMagick_FIND_COMPONENTS} FIND_IMAGEMAGICK_API(Magick++ Magick++.h Magick++ CORE_RL_Magick++_ ) + LIST(APPEND ImageMagick_REQUIRED_VARS ImageMagick_Magick++_LIBRARY) ELSEIF(component STREQUAL "MagickWand") FIND_IMAGEMAGICK_API(MagickWand wand/MagickWand.h Wand MagickWand CORE_RL_wand_ ) + LIST(APPEND ImageMagick_REQUIRED_VARS ImageMagick_MagickWand_LIBRARY) ELSEIF(component STREQUAL "MagickCore") FIND_IMAGEMAGICK_API(MagickCore magick/MagickCore.h Magick MagickCore CORE_RL_magick_ ) + LIST(APPEND ImageMagick_REQUIRED_VARS ImageMagick_MagickCore_LIBRARY) ELSE(component STREQUAL "Magick++") IF(ImageMagick_EXECUTABLE_DIR) FIND_IMAGEMAGICK_EXE(${component}) ENDIF(ImageMagick_EXECUTABLE_DIR) + + 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(is_requested GREATER -1) + ELSEIF(ImageMagick_${component}_EXECUTABLE) + # if no components were requested explicitely put all (default) executables + # in the list + LIST(APPEND ImageMagick_DEFAULT_EXECUTABLES "${ImageMagick_${component}_EXECUTABLE}") + ENDIF(ImageMagick_FIND_COMPONENTS) 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(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}) +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]") + STRING(REGEX REPLACE "^Version: ImageMagick ([-0-9\\.]+).*" "\\1" ImageMagick_VERSION_STRING "${imagemagick_version}") + ENDIF() + UNSET(imagemagick_version) +ENDIF(ImageMagick_mogrify_EXECUTABLE) + #--------------------------------------------------------------------- # Standard Package Output #--------------------------------------------------------------------- INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -FIND_PACKAGE_HANDLE_STANDARD_ARGS( - ImageMagick DEFAULT_MSG ImageMagick_FOUND +FIND_PACKAGE_HANDLE_STANDARD_ARGS(ImageMagick + REQUIRED_VARS ${ImageMagick_REQUIRED_VARS} + VERSION_VAR ImageMagick_VERSION_STRING ) # Maintain consistency with all other variables. SET(ImageMagick_FOUND ${IMAGEMAGICK_FOUND}) diff --git a/Modules/FindJasper.cmake b/Modules/FindJasper.cmake index 48e2736..6dc7e4d 100644 --- a/Modules/FindJasper.cmake +++ b/Modules/FindJasper.cmake @@ -27,7 +27,7 @@ IF (NOT JASPER_LIBRARIES) FIND_PACKAGE(JPEG) FIND_LIBRARY(JASPER_LIBRARY_RELEASE NAMES jasper libjasper) - FIND_LIBRARY(JASPER_LIBRARY_DEBUG NAMES japserd) + FIND_LIBRARY(JASPER_LIBRARY_DEBUG NAMES jasperd) INCLUDE(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) SELECT_LIBRARY_CONFIGURATIONS(JASPER) diff --git a/Modules/FindLibXml2.cmake b/Modules/FindLibXml2.cmake index a797b12..48a5498 100644 --- a/Modules/FindLibXml2.cmake +++ b/Modules/FindLibXml2.cmake @@ -45,15 +45,22 @@ FIND_PROGRAM(LIBXML2_XMLLINT_EXECUTABLE xmllint) # for backwards compat. with KDE 4.0.x: SET(XMLLINT_EXECUTABLE "${LIBXML2_XMLLINT_EXECUTABLE}") +IF(PC_LIBXML_VERSION) + SET(LIBXML2_VERSION_STRING ${PC_LIBXML_VERSION}) +ELSEIF(LIBXML2_INCLUDE_DIR AND EXISTS "${LIBXML2_INCLUDE_DIR}/libxml/xmlversion.h") + FILE(STRINGS "${LIBXML2_INCLUDE_DIR}/libxml/xmlversion.h" libxml2_version_str + REGEX "^#define[\t ]+LIBXML_DOTTED_VERSION[\t ]+\".*\"") + + STRING(REGEX REPLACE "^#define[\t ]+LIBXML_DOTTED_VERSION[\t ]+\"([^\"]*)\".*" "\\1" + LIBXML2_VERSION_STRING "${libxml2_version_str}") + UNSET(libxml2_version_str) +ENDIF() + # handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if # all listed variables are TRUE INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 REQUIRED_VARS LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR - VERSION_VAR PC_LIBXML_VERSION) - -IF(LIBXML2_FOUND) - SET(LIBXML2_VERSION_STRING ${PC_LIBXML_VERSION}) -ENDIF() + VERSION_VAR LIBXML2_VERSION_STRING) MARK_AS_ADVANCED(LIBXML2_INCLUDE_DIR LIBXML2_LIBRARIES LIBXML2_XMLLINT_EXECUTABLE) diff --git a/Modules/FindLua51.cmake b/Modules/FindLua51.cmake index 123fd5d..b67dd4c 100644 --- a/Modules/FindLua51.cmake +++ b/Modules/FindLua51.cmake @@ -2,7 +2,8 @@ # This module defines # LUA51_FOUND, if false, do not try to link to Lua # LUA_LIBRARIES -# LUA_INCLUDE_DIR, where to find lua.h +# LUA_INCLUDE_DIR, where to find lua.h +# LUA_VERSION_STRING, the version of Lua found (since CMake 2.8.8) # # Note that the expected include convention is # #include "lua.h" @@ -66,10 +67,19 @@ IF(LUA_LIBRARY) ENDIF(UNIX AND NOT APPLE) ENDIF(LUA_LIBRARY) +IF(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h") + FILE(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"") + + STRING(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUA_VERSION_STRING "${lua_version_str}") + UNSET(lua_version_str) +ENDIF() + INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) # handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if # all listed variables are TRUE -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua51 DEFAULT_MSG LUA_LIBRARIES LUA_INCLUDE_DIR) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua51 + REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR + VERSION_VAR LUA_VERSION_STRING) MARK_AS_ADVANCED(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY) diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index 59efe4b..d1fc2d2 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -213,6 +213,37 @@ ELSE(WIN32 AND NOT CYGWIN) ENDIF(WIN32 AND NOT CYGWIN) +function(from_hex HEX DEC) + string(TOUPPER "${HEX}" HEX) + set(_res 0) + string(LENGTH "${HEX}" _strlen) + + while (_strlen GREATER 0) + math(EXPR _res "${_res} * 16") + string(SUBSTRING "${HEX}" 0 1 NIBBLE) + string(SUBSTRING "${HEX}" 1 -1 HEX) + if (NIBBLE STREQUAL "A") + math(EXPR _res "${_res} + 10") + elseif (NIBBLE STREQUAL "B") + math(EXPR _res "${_res} + 11") + elseif (NIBBLE STREQUAL "C") + math(EXPR _res "${_res} + 12") + elseif (NIBBLE STREQUAL "D") + math(EXPR _res "${_res} + 13") + elseif (NIBBLE STREQUAL "E") + math(EXPR _res "${_res} + 14") + elseif (NIBBLE STREQUAL "F") + math(EXPR _res "${_res} + 15") + else() + math(EXPR _res "${_res} + ${NIBBLE}") + endif() + + string(LENGTH "${HEX}" _strlen) + endwhile() + + set(${DEC} ${_res} PARENT_SCOPE) +endfunction(from_hex) + if (OPENSSL_INCLUDE_DIR) if (_OPENSSL_VERSION) set(OPENSSL_VERSION "${_OPENSSL_VERSION}") @@ -231,15 +262,16 @@ if (OPENSSL_INCLUDE_DIR) "\\1;\\2;\\3;\\4;\\5" OPENSSL_VERSION_LIST "${openssl_version_str}") list(GET OPENSSL_VERSION_LIST 0 OPENSSL_VERSION_MAJOR) list(GET OPENSSL_VERSION_LIST 1 OPENSSL_VERSION_MINOR) + from_hex("${OPENSSL_VERSION_MINOR}" OPENSSL_VERSION_MINOR) list(GET OPENSSL_VERSION_LIST 2 OPENSSL_VERSION_FIX) + from_hex("${OPENSSL_VERSION_FIX}" OPENSSL_VERSION_FIX) list(GET OPENSSL_VERSION_LIST 3 OPENSSL_VERSION_PATCH) - string(REGEX REPLACE "^0(.)" "\\1" OPENSSL_VERSION_MINOR "${OPENSSL_VERSION_MINOR}") - string(REGEX REPLACE "^0(.)" "\\1" OPENSSL_VERSION_FIX "${OPENSSL_VERSION_FIX}") - if (NOT OPENSSL_VERSION_PATCH STREQUAL "00") + from_hex("${OPENSSL_VERSION_PATCH}" _tmp) # 96 is the ASCII code of 'a' minus 1 - math(EXPR OPENSSL_VERSION_PATCH_ASCII "${OPENSSL_VERSION_PATCH} + 96") + math(EXPR OPENSSL_VERSION_PATCH_ASCII "${_tmp} + 96") + unset(_tmp) # Once anyone knows how OpenSSL would call the patch versions beyond 'z' # this should be updated to handle that, too. This has not happened yet # so it is simply ignored here for now. diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake index f616973..a6c181c 100644 --- a/Modules/FindPNG.cmake +++ b/Modules/FindPNG.cmake @@ -7,6 +7,7 @@ # PNG_LIBRARIES, the libraries to link against to use PNG. # PNG_DEFINITIONS - You should add_definitons(${PNG_DEFINITIONS}) before compiling code that includes png library files. # PNG_FOUND, If false, do not try to use PNG. +# PNG_VERSION_STRING - the version of the PNG library found (since CMake 2.8.8) # Also defined, but not for general use are # PNG_LIBRARY, where to find the PNG library. # For backward compatiblity the variable PNG_INCLUDE_DIR is also set. It has the same value as PNG_INCLUDE_DIRS. @@ -56,11 +57,19 @@ if(ZLIB_FOUND) endif (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR) + if (PNG_PNG_INCLUDE_DIR AND EXISTS "${PNG_PNG_INCLUDE_DIR}/png.h") + file(STRINGS "${PNG_PNG_INCLUDE_DIR}/png.h" png_version_str REGEX "^#define[ \t]+PNG_LIBPNG_VER_STRING[ \t]+\".+\"") + + string(REGEX REPLACE "^#define[ \t]+PNG_LIBPNG_VER_STRING[ \t]+\"([^\"]+)\".*" "\\1" PNG_VERSION_STRING "${png_version_str}") + unset(png_version_str) + endif (PNG_PNG_INCLUDE_DIR AND EXISTS "${PNG_PNG_INCLUDE_DIR}/png.h") endif(ZLIB_FOUND) # handle the QUIETLY and REQUIRED arguments and set PNG_FOUND to TRUE if # all listed variables are TRUE include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -find_package_handle_standard_args(PNG DEFAULT_MSG PNG_LIBRARY PNG_PNG_INCLUDE_DIR) +find_package_handle_standard_args(PNG + REQUIRED_VARS PNG_LIBRARY PNG_PNG_INCLUDE_DIR + VERSION_VAR PNG_VERSION_STRING) mark_as_advanced(PNG_PNG_INCLUDE_DIR PNG_LIBRARY ) diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake index 55f95c6..94e5676 100644 --- a/Modules/FindPostgreSQL.cmake +++ b/Modules/FindPostgreSQL.cmake @@ -1,20 +1,11 @@ # - Find the PostgreSQL installation. -# Usage: -# In your CMakeLists.txt file do something like this: -# ... -# # PostgreSQL -# FIND_PACKAGE(PostgreSQL) -# ... -# if( PostgreSQL_FOUND ) -# include_directories(${PostgreSQL_INCLUDE_DIRS}) -# endif( PostgreSQL_FOUND ) -# ... -# Remember to include ${PostgreSQL_LIBRARIES} in the target_link_libraries() statement. -# -# # In Windows, we make the assumption that, if the PostgreSQL files are installed, the default directory # will be C:\Program Files\PostgreSQL. # +# This module defines +# PostgreSQL_LIBRARIES - the PostgreSQL libraries needed for linking +# PostgreSQL_INCLUDE_DIRS - the directories of the PostgreSQL headers +# PostgreSQL_VERSION_STRING - the version of PostgreSQL found (since CMake 2.8.8) #============================================================================= # Copyright 2004-2009 Kitware, Inc. @@ -150,11 +141,20 @@ find_library( PostgreSQL_LIBRARY ) get_filename_component(PostgreSQL_LIBRARY_DIR ${PostgreSQL_LIBRARY} PATH) +if (PostgreSQL_INCLUDE_DIR AND EXISTS "${PostgreSQL_INCLUDE_DIR}/pg_config.h") + file(STRINGS "${PostgreSQL_INCLUDE_DIR}/pg_config.h" pgsql_version_str + REGEX "^#define[\t ]+PG_VERSION[\t ]+\".*\"") + + string(REGEX REPLACE "^#define[\t ]+PG_VERSION[\t ]+\"([^\"]*)\".*" "\\1" + PostgreSQL_VERSION_STRING "${pgsql_version_str}") + unset(pgsql_version_str) +endif() + # Did we find anything? include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(PostgreSQL DEFAULT_MSG - PostgreSQL_LIBRARY PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR) - +find_package_handle_standard_args(PostgreSQL + REQUIRED_VARS PostgreSQL_LIBRARY PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR + VERSION_VAR PostgreSQL_VERSION_STRING) set( PostgreSQL_FOUND ${POSTGRESQL_FOUND}) # Now try to get the include and library path. diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake index d5a2a5e..5c1d56b 100644 --- a/Modules/FindPythonInterp.cmake +++ b/Modules/FindPythonInterp.cmake @@ -88,8 +88,19 @@ endif() # determine python version string if(PYTHON_EXECUTABLE) - execute_process(COMMAND "${PYTHON_EXECUTABLE}" --version ERROR_VARIABLE _VERSION OUTPUT_QUIET ERROR_STRIP_TRAILING_WHITESPACE) - if(_VERSION MATCHES "^Python [0-9]+\\.[0-9]+.*") + execute_process(COMMAND "${PYTHON_EXECUTABLE}" --version + ERROR_VARIABLE _VERSION + RESULT_VARIABLE _PYTHON_VERSION_RESULT + OUTPUT_QUIET + ERROR_STRIP_TRAILING_WHITESPACE) + if(_PYTHON_VERSION_RESULT) + execute_process(COMMAND "${PYTHON_EXECUTABLE}" -V + ERROR_VARIABLE _VERSION + RESULT_VARIABLE _PYTHON_VERSION_RESULT + OUTPUT_QUIET + ERROR_STRIP_TRAILING_WHITESPACE) + endif(_PYTHON_VERSION_RESULT) + if(NOT _PYTHON_VERSION_RESULT AND _VERSION MATCHES "^Python [0-9]+\\.[0-9]+.*") string(REPLACE "Python " "" PYTHON_VERSION_STRING "${_VERSION}") string(REGEX REPLACE "^([0-9]+)\\.[0-9]+.*" "\\1" PYTHON_VERSION_MAJOR "${PYTHON_VERSION_STRING}") string(REGEX REPLACE "^[0-9]+\\.([0-9])+.*" "\\1" PYTHON_VERSION_MINOR "${PYTHON_VERSION_STRING}") @@ -97,6 +108,8 @@ if(PYTHON_EXECUTABLE) string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" PYTHON_VERSION_PATCH "${PYTHON_VERSION_STRING}") endif() endif() + unset(_PYTHON_VERSION_RESULT) + unset(_VERSION) endif(PYTHON_EXECUTABLE) # handle the QUIETLY and REQUIRED arguments and set PYTHONINTERP_FOUND to TRUE if diff --git a/Modules/FindRuby.cmake b/Modules/FindRuby.cmake index 5d6c98a..c4adfd1 100644 --- a/Modules/FindRuby.cmake +++ b/Modules/FindRuby.cmake @@ -139,7 +139,7 @@ ENDIF(RUBY_EXECUTABLE AND NOT RUBY_VERSION_MAJOR) # In case RUBY_EXECUTABLE could not be executed (e.g. cross compiling) # try to detect which version we found. This is not too good. -IF(NOT RUBY_VERSION_MAJOR) +IF(RUBY_EXECUTABLE AND NOT RUBY_VERSION_MAJOR) # by default assume 1.8.0 SET(RUBY_VERSION_MAJOR 1) SET(RUBY_VERSION_MINOR 8) @@ -149,13 +149,14 @@ IF(NOT RUBY_VERSION_MAJOR) SET(RUBY_VERSION_MAJOR 1) SET(RUBY_VERSION_MINOR 9) ENDIF(${RUBY_EXECUTABLE} MATCHES "ruby1.?9" OR RUBY_HDR_DIR) -ENDIF(NOT RUBY_VERSION_MAJOR) +ENDIF(RUBY_EXECUTABLE AND NOT RUBY_VERSION_MAJOR) - -SET(RUBY_VERSION "${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}.${RUBY_VERSION_PATCH}") -SET(_RUBY_VERSION_SHORT "${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}") -SET(_RUBY_VERSION_SHORT_NODOT "${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}") -SET(_RUBY_NODOT_VERSION "${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}${RUBY_VERSION_PATCH}") +IF(RUBY_VERSION_MAJOR) + SET(RUBY_VERSION "${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}.${RUBY_VERSION_PATCH}") + SET(_RUBY_VERSION_SHORT "${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}") + SET(_RUBY_VERSION_SHORT_NODOT "${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}") + SET(_RUBY_NODOT_VERSION "${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}${RUBY_VERSION_PATCH}") +ENDIF(RUBY_VERSION_MAJOR) FIND_PATH(RUBY_INCLUDE_DIR NAMES ruby.h @@ -167,7 +168,7 @@ FIND_PATH(RUBY_INCLUDE_DIR SET(RUBY_INCLUDE_DIRS ${RUBY_INCLUDE_DIR} ) # if ruby > 1.8 is required or if ruby > 1.8 was found, search for the config.h dir -IF( ${Ruby_FIND_VERSION_SHORT_NODOT} GREATER 18 OR ${_RUBY_VERSION_SHORT_NODOT} GREATER 18 OR RUBY_HDR_DIR) +IF( "${Ruby_FIND_VERSION_SHORT_NODOT}" GREATER 18 OR "${_RUBY_VERSION_SHORT_NODOT}" GREATER 18 OR RUBY_HDR_DIR) FIND_PATH(RUBY_CONFIG_INCLUDE_DIR NAMES ruby/config.h config.h HINTS @@ -176,7 +177,7 @@ IF( ${Ruby_FIND_VERSION_SHORT_NODOT} GREATER 18 OR ${_RUBY_VERSION_SHORT_NODOT ) SET(RUBY_INCLUDE_DIRS ${RUBY_INCLUDE_DIRS} ${RUBY_CONFIG_INCLUDE_DIR} ) -ENDIF( ${Ruby_FIND_VERSION_SHORT_NODOT} GREATER 18 OR ${_RUBY_VERSION_SHORT_NODOT} GREATER 18 OR RUBY_HDR_DIR) +ENDIF( "${Ruby_FIND_VERSION_SHORT_NODOT}" GREATER 18 OR "${_RUBY_VERSION_SHORT_NODOT}" GREATER 18 OR RUBY_HDR_DIR) # Determine the list of possible names for the ruby library diff --git a/Modules/FindTCL.cmake b/Modules/FindTCL.cmake index 13f32f8..f2c776f 100644 --- a/Modules/FindTCL.cmake +++ b/Modules/FindTCL.cmake @@ -48,10 +48,14 @@ INCLUDE(CMakeFindFrameworks) INCLUDE(FindTclsh) INCLUDE(FindWish) -GET_FILENAME_COMPONENT(TCL_TCLSH_PATH "${TCL_TCLSH}" PATH) -GET_FILENAME_COMPONENT(TCL_TCLSH_PATH_PARENT "${TCL_TCLSH_PATH}" PATH) -STRING(REGEX REPLACE - "^.*tclsh([0-9]\\.*[0-9]).*$" "\\1" TCL_TCLSH_VERSION "${TCL_TCLSH}") +IF(TCLSH_VERSION_STRING) + SET(TCL_TCLSH_VERSION "${TCLSH_VERSION_STRING}") +ELSE(TCLSH_VERSION_STRING) + GET_FILENAME_COMPONENT(TCL_TCLSH_PATH "${TCL_TCLSH}" PATH) + GET_FILENAME_COMPONENT(TCL_TCLSH_PATH_PARENT "${TCL_TCLSH_PATH}" PATH) + STRING(REGEX REPLACE + "^.*tclsh([0-9]\\.*[0-9]).*$" "\\1" TCL_TCLSH_VERSION "${TCL_TCLSH}") +ENDIF(TCLSH_VERSION_STRING) GET_FILENAME_COMPONENT(TK_WISH_PATH "${TK_WISH}" PATH) GET_FILENAME_COMPONENT(TK_WISH_PATH_PARENT "${TK_WISH_PATH}" PATH) diff --git a/Modules/FindTIFF.cmake b/Modules/FindTIFF.cmake index 714f65f..16f9e23 100644 --- a/Modules/FindTIFF.cmake +++ b/Modules/FindTIFF.cmake @@ -25,10 +25,21 @@ FIND_PATH(TIFF_INCLUDE_DIR tiff.h) SET(TIFF_NAMES ${TIFF_NAMES} tiff libtiff tiff3 libtiff3) FIND_LIBRARY(TIFF_LIBRARY NAMES ${TIFF_NAMES} ) +IF(TIFF_INCLUDE_DIR AND EXISTS "${TIFF_INCLUDE_DIR}/tiffvers.h") + FILE(STRINGS "${TIFF_INCLUDE_DIR}/tiffvers.h" tiff_version_str + REGEX "^#define[\t ]+TIFFLIB_VERSION_STR[\t ]+\"LIBTIFF, Version .*") + + STRING(REGEX REPLACE "^#define[\t ]+TIFFLIB_VERSION_STR[\t ]+\"LIBTIFF, Version +([^ \\n]*).*" + "\\1" TIFF_VERSION_STRING "${tiff_version_str}") + UNSET(tiff_version_str) +ENDIF() + # handle the QUIETLY and REQUIRED arguments and set TIFF_FOUND to TRUE if # all listed variables are TRUE INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(TIFF DEFAULT_MSG TIFF_LIBRARY TIFF_INCLUDE_DIR) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(TIFF + REQUIRED_VARS TIFF_LIBRARY TIFF_INCLUDE_DIR + VERSION_VAR TIFF_VERSION_STRING) IF(TIFF_FOUND) SET( TIFF_LIBRARIES ${TIFF_LIBRARY} ) diff --git a/Modules/FindTclsh.cmake b/Modules/FindTclsh.cmake index 8fde59e..a45f285 100644 --- a/Modules/FindTclsh.cmake +++ b/Modules/FindTclsh.cmake @@ -82,9 +82,19 @@ FIND_PROGRAM(TCL_TCLSH HINTS ${TCLTK_POSSIBLE_BIN_PATHS} ) +IF(TCL_TCLSH) + EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" -E echo puts "\$tcl_version" + COMMAND "${TCL_TCLSH}" + OUTPUT_VARIABLE TCLSH_VERSION_STRING + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) +ENDIF(TCL_TCLSH) + # handle the QUIETLY and REQUIRED arguments and set TIFF_FOUND to TRUE if # all listed variables are TRUE INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Tclsh DEFAULT_MSG TCL_TCLSH) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Tclsh + REQUIRED_VARS TCL_TCLSH + VERSION_VAR TCLSH_VERSION_STRING) MARK_AS_ADVANCED(TCL_TCLSH) diff --git a/Modules/SelectLibraryConfigurations.cmake b/Modules/SelectLibraryConfigurations.cmake index 51b4dda..2e8ade0 100644 --- a/Modules/SelectLibraryConfigurations.cmake +++ b/Modules/SelectLibraryConfigurations.cmake @@ -15,7 +15,6 @@ # basename_LIBRARY and basename_LIBRARIES will take only the release values. #============================================================================= -# Copyright 2009 Kitware, Inc. # Copyright 2009 Will Dicharry <wdicharry@stellarscience.com> # Copyright 2005-2009 Kitware, Inc. # @@ -49,7 +48,8 @@ macro( select_library_configurations basename ) # if only the debug version was found, set the release value to be the # debug value. _set_library_name( ${basename} DEBUG RELEASE ) - if (${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE ) + if (${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE AND + NOT ${basename}_LIBRARY_DEBUG STREQUAL ${basename}_LIBRARY_RELEASE) # if the generator supports configuration types or CMAKE_BUILD_TYPE # is set, then set optimized and debug options. if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE ) @@ -65,7 +65,7 @@ macro( select_library_configurations basename ) set( ${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE} ) set( ${basename}_LIBRARIES ${${basename}_LIBRARY_RELEASE} ) endif( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE ) - endif( ${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE ) + endif() set( ${basename}_LIBRARY ${${basename}_LIBRARY} CACHE FILEPATH "The ${basename} library" ) @@ -79,4 +79,3 @@ macro( select_library_configurations basename ) ${basename}_LIBRARY_DEBUG ) endmacro( select_library_configurations ) - |