1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 02:08:27 +08:00
Files
CMake/Tests/FindPython/FindPythonScript.cmake
Marc Chevrier a92d384548 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
2020-08-07 09:24:18 -04:00

10 lines
300 B
CMake

cmake_minimum_required(VERSION 3.12)
if (PYTHON_MUST_NOT_BE_FOUND)
find_package(${PYTHON_PACKAGE_NAME} QUIET)
if (${PYTHON_PACKAGE_NAME}_FOUND)
message(FATAL_ERROR "${PYTHON_PACKAGE_NAME}: unexpectedly founded.")
endif()
else()
find_package(${PYTHON_PACKAGE_NAME} REQUIRED QUIET)
endif()