diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2020-08-04 14:40:50 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-08-07 13:24:18 (GMT) |
commit | a92d3845489c2f420ab2ad461404157d2da3a73d (patch) | |
tree | 8dc345763d1c31ad23c945cf385b7ccf04e5aab5 /Modules/FindPython | |
parent | 63a65baf4c343c73b2142078ef0045d3711dea1d (diff) | |
download | CMake-a92d3845489c2f420ab2ad461404157d2da3a73d.zip CMake-a92d3845489c2f420ab2ad461404157d2da3a73d.tar.gz CMake-a92d3845489c2f420ab2ad461404157d2da3a73d.tar.bz2 |
FindPython: ensure user's policies are respected
Do not set the policy version before recording our internal macros such
as `__Python_add_library`. Otherwise callers get our policy version
instead of theirs. Instead just set the specific policies we need.
Also fix one case in our test suite where we were accidentally
relying on the policy version to be set by `FindPython`.
Fixes: #21042
Diffstat (limited to 'Modules/FindPython')
-rw-r--r-- | Modules/FindPython/Support.cmake | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake index 1be0625..9b65f39 100644 --- a/Modules/FindPython/Support.cmake +++ b/Modules/FindPython/Support.cmake @@ -5,17 +5,13 @@ # This file is a "template" file used by various FindPython modules. # -cmake_policy (GET CMP0094 _${_PYTHON_PREFIX}_LOOKUP_POLICY) - -cmake_policy (VERSION 3.7) - -if (_${_PYTHON_PREFIX}_LOOKUP_POLICY) - cmake_policy (SET CMP0094 ${_${_PYTHON_PREFIX}_LOOKUP_POLICY}) -endif() - # # Initial configuration # + +# IN_LIST operator +cmake_policy (SET CMP0057 NEW) + if (NOT DEFINED _PYTHON_PREFIX) message (FATAL_ERROR "FindPython: INTERNAL ERROR") endif() @@ -1097,6 +1093,7 @@ endif() unset (${_PYTHON_PREFIX}_SOABI) # Define lookup strategy +cmake_policy (GET CMP0094 _${_PYTHON_PREFIX}_LOOKUP_POLICY) if (_${_PYTHON_PREFIX}_LOOKUP_POLICY STREQUAL "NEW") set (_${_PYTHON_PREFIX}_FIND_STRATEGY "LOCATION") else() |