Commit 124472e9 authored by Brad King's avatar Brad King Committed by Kitware Robot
Browse files

Merge topic 'FindPython-stabilization'

b1fd2bbe

 FindPython: enhance multiple major versions lookup
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !1915
parents 74005a13 b1fd2bbe
Pipeline #97546 passed with stage
in 0 seconds
...@@ -144,18 +144,19 @@ else() ...@@ -144,18 +144,19 @@ else()
set (Python_FIND_QUIETLY TRUE) set (Python_FIND_QUIETLY TRUE)
set (Python_FIND_REQUIRED FALSE) set (Python_FIND_REQUIRED FALSE)
foreach (_Python_REQUIRED_VERSION_MAJOR IN ITEMS 3 2) set (_Python_REQUIRED_VERSIONS 3 2)
set (_Python_REQUIRED_VERSION_LAST 2)
foreach (_Python_REQUIRED_VERSION_MAJOR IN LISTS _Python_REQUIRED_VERSIONS)
set (Python_FIND_VERSION ${_Python_REQUIRED_VERSION_MAJOR}) set (Python_FIND_VERSION ${_Python_REQUIRED_VERSION_MAJOR})
include (${CMAKE_CURRENT_LIST_DIR}/FindPython/Support.cmake) include (${CMAKE_CURRENT_LIST_DIR}/FindPython/Support.cmake)
if (Python_FOUND) if (Python_FOUND OR
_Python_REQUIRED_VERSION_MAJOR EQUAL _Python_REQUIRED_VERSION_LAST)
break() break()
endif() endif()
# clean-up some CACHE variables to ensure look-up restart from scratch # clean-up some CACHE variables to ensure look-up restart from scratch
foreach (_Python_ITEM IN ITEMS EXECUTABLE COMPILER foreach (_Python_ITEM IN LISTS _Python_CACHED_VARS)
LIBRARY_RELEASE RUNTIME_LIBRARY_RELEASE unset (${_Python_ITEM} CACHE)
LIBRARY_DEBUG RUNTIME_LIBRARY_DEBUG
INCLUDE_DIR)
unset (Python_${_Python_ITEM} CACHE)
endforeach() endforeach()
endforeach() endforeach()
......
...@@ -162,12 +162,14 @@ unset (${_PYTHON_PREFIX}_VERSION_MINOR) ...@@ -162,12 +162,14 @@ unset (${_PYTHON_PREFIX}_VERSION_MINOR)
unset (${_PYTHON_PREFIX}_VERSION_PATCH) unset (${_PYTHON_PREFIX}_VERSION_PATCH)
unset (_${_PYTHON_PREFIX}_REQUIRED_VARS) unset (_${_PYTHON_PREFIX}_REQUIRED_VARS)
unset (_${_PYTHON_PREFIX}_CACHED_VARS)
# first step, search for the interpreter # first step, search for the interpreter
if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
if (${_PYTHON_PREFIX}_FIND_REQUIRED_Interpreter) if (${_PYTHON_PREFIX}_FIND_REQUIRED_Interpreter)
list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VARS ${_PYTHON_PREFIX}_EXECUTABLE) list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VARS ${_PYTHON_PREFIX}_EXECUTABLE)
list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS ${_PYTHON_PREFIX}_EXECUTABLE)
endif() endif()
set (_${_PYTHON_PREFIX}_HINTS "${${_PYTHON_PREFIX}_ROOT_DIR}" ENV ${_PYTHON_PREFIX}_ROOT_DIR) set (_${_PYTHON_PREFIX}_HINTS "${${_PYTHON_PREFIX}_ROOT_DIR}" ENV ${_PYTHON_PREFIX}_ROOT_DIR)
...@@ -305,6 +307,7 @@ endif() ...@@ -305,6 +307,7 @@ endif()
if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
if (${_PYTHON_PREFIX}_FIND_REQUIRED_Compiler) if (${_PYTHON_PREFIX}_FIND_REQUIRED_Compiler)
list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VARS ${_PYTHON_PREFIX}_COMPILER) list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VARS ${_PYTHON_PREFIX}_COMPILER)
list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS ${_PYTHON_PREFIX}_COMPILER)
endif() endif()
# IronPython specific artifacts # IronPython specific artifacts
...@@ -393,6 +396,12 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS ...@@ -393,6 +396,12 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
if (${_PYTHON_PREFIX}_FIND_REQUIRED_Development) if (${_PYTHON_PREFIX}_FIND_REQUIRED_Development)
list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VARS ${_PYTHON_PREFIX}_LIBRARY list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VARS ${_PYTHON_PREFIX}_LIBRARY
${_PYTHON_PREFIX}_INCLUDE_DIR) ${_PYTHON_PREFIX}_INCLUDE_DIR)
list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS ${_PYTHON_PREFIX}_LIBRARY
${_PYTHON_PREFIX}_LIBRARY_RELEASE
${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE
${_PYTHON_PREFIX}_LIBRARY_DEBUG
${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG
${_PYTHON_PREFIX}_INCLUDE_DIR)
endif() endif()
# Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES # Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment