diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeFindDependencyMacro.cmake | 7 | ||||
-rw-r--r-- | Modules/FeatureSummary.cmake | 2 | ||||
-rw-r--r-- | Modules/FindPythonInterp.cmake | 27 | ||||
-rw-r--r-- | Modules/FindPythonLibs.cmake | 4 |
4 files changed, 29 insertions, 11 deletions
diff --git a/Modules/CMakeFindDependencyMacro.cmake b/Modules/CMakeFindDependencyMacro.cmake index 99ffca8..73efaae 100644 --- a/Modules/CMakeFindDependencyMacro.cmake +++ b/Modules/CMakeFindDependencyMacro.cmake @@ -31,14 +31,17 @@ macro(find_dependency dep) if (NOT ${dep}_FOUND) set(cmake_fd_version) if (${ARGC} GREATER 1) - if (${ARGV1} STREQUAL EXACT) + if ("${ARGV1}" STREQUAL "") + message(FATAL_ERROR "Invalid arguments to find_dependency. VERSION is empty") + endif() + if ("${ARGV1}" STREQUAL EXACT) message(FATAL_ERROR "Invalid arguments to find_dependency. EXACT may only be specified if a VERSION is specified") endif() set(cmake_fd_version ${ARGV1}) endif() set(cmake_fd_exact_arg) if(${ARGC} GREATER 2) - if (NOT ${ARGV2} STREQUAL EXACT) + if (NOT "${ARGV2}" STREQUAL EXACT) message(FATAL_ERROR "Invalid arguments to find_dependency") endif() set(cmake_fd_exact_arg EXACT) diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake index 6696515..a72954c 100644 --- a/Modules/FeatureSummary.cmake +++ b/Modules/FeatureSummary.cmake @@ -492,6 +492,8 @@ function(FEATURE_SUMMARY) set(title_ENABLED_FEATURES "The following features have been enabled:") set(title_DISABLED_FEATURES "The following features have been disabled:") + set(title_PACKAGES_FOUND "The following packages have been found:") + set(title_PACKAGES_NOT_FOUND "The following packages have not been found:") set(title_OPTIONAL_PACKAGES_FOUND "The following OPTIONAL packages have been found:") set(title_OPTIONAL_PACKAGES_NOT_FOUND "The following OPTIONAL packages have not been found:") set(title_RECOMMENDED_PACKAGES_FOUND "The following RECOMMENDED packages have been found:") diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake index e23a58b..c41f3a7 100644 --- a/Modules/FindPythonInterp.cmake +++ b/Modules/FindPythonInterp.cmake @@ -27,6 +27,10 @@ # of version numbers that should be taken into account when searching # for Python. You need to set this variable before calling # find_package(PythonInterp). +# +# If also calling find_package(PythonLibs), call find_package(PythonInterp) +# first to get the currently active Python version by default with a consistent +# version of PYTHON_LIBRARIES. #============================================================================= # Copyright 2005-2010 Kitware, Inc. @@ -71,18 +75,23 @@ if(PythonInterp_FIND_VERSION) else() set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS}) endif() - -list(APPEND _Python_NAMES python) - -# Search for the current active python version first find_program(PYTHON_EXECUTABLE NAMES ${_Python_NAMES}) # Set up the versions we know about, in the order we will search. Always add # the user supplied additional versions to the front. -set(_Python_VERSIONS - ${Python_ADDITIONAL_VERSIONS} - ${_PYTHON_FIND_OTHER_VERSIONS} - ) +set(_Python_VERSIONS ${Python_ADDITIONAL_VERSIONS}) +# If FindPythonInterp has already found the major and minor version, +# insert that version next to get consistent versions of the interpreter and +# library. +if(DEFINED PYTHONLIBS_VERSION_STRING) + string(REPLACE "." ";" _PYTHONLIBS_VERSION "${PYTHONLIBS_VERSION_STRING}") + list(GET _PYTHONLIBS_VERSION 0 _PYTHONLIBS_VERSION_MAJOR) + list(GET _PYTHONLIBS_VERSION 1 _PYTHONLIBS_VERSION_MINOR) + list(APPEND _Python_VERSIONS ${_PYTHONLIBS_VERSION_MAJOR}.${_PYTHONLIBS_VERSION_MINOR}) +endif() +# Search for the current active python version first +list(APPEND _Python_VERSIONS ";") +list(APPEND _Python_VERSIONS ${_PYTHON_FIND_OTHER_VERSIONS}) unset(_PYTHON_FIND_OTHER_VERSIONS) unset(_PYTHON1_VERSIONS) @@ -91,7 +100,7 @@ unset(_PYTHON3_VERSIONS) # Search for newest python version if python executable isn't found if(NOT PYTHON_EXECUTABLE) - foreach(_CURRENT_VERSION ${_Python_VERSIONS}) + foreach(_CURRENT_VERSION IN LISTS _Python_VERSIONS) set(_Python_NAMES python${_CURRENT_VERSION}) if(WIN32) list(APPEND _Python_NAMES python) diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake index 40c7d50..cc875ad 100644 --- a/Modules/FindPythonLibs.cmake +++ b/Modules/FindPythonLibs.cmake @@ -31,6 +31,10 @@ # # PYTHON_LIBRARY - path to the python library # PYTHON_INCLUDE_DIR - path to where Python.h is found +# +# If also calling find_package(PythonInterp), call find_package(PythonInterp) +# first to get the currently active Python version by default with a consistent +# version of PYTHON_LIBRARIES. #============================================================================= # Copyright 2001-2009 Kitware, Inc. |