Skip to content

Commit 2d8849a

Browse files
committed
[vcpkg-ci-python] Disable CMP0148 on CMake 4.x
Disable tests for #47284 for now.
1 parent 42b79fd commit 2d8849a

File tree

1 file changed

+26
-31
lines changed

1 file changed

+26
-31
lines changed

scripts/test_ports/vcpkg-ci-python3/project/CMakeLists.txt

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
cmake_minimum_required(VERSION 3.12)
22
project(python3-test)
33

4-
set(Python_ARTIFACTS_PREFIX "_MEOW")
5-
6-
# We need to opt-out of CMP0148 to be able to test the pre-CMake 3.12 Python
7-
# find modules. The old policy is deprecated, so, at some point, this aspect
8-
# of the test will have to go away.
9-
if(POLICY CMP0148)
10-
cmake_policy(SET CMP0148 OLD)
11-
endif()
4+
if("${CMAKE_VERSION}" VERSION_LESS "4.0")
5+
# We need to opt-out of CMP0148 to be able to test the pre-CMake 3.12 Python
6+
# find modules. The old policy is deprecated, so, at some point, this aspect
7+
# of the test will have to go away.
8+
if(POLICY CMP0148)
9+
cmake_policy(SET CMP0148 OLD)
10+
endif()
1211

13-
# The purpose of this test is to ensure that we get the expected values
14-
# from the finders, not crosscompiling. So, let's not even go there.
15-
# These find_package() calls aren't required because FindPythonInterp
16-
# seems to not return a result in CI. Probably because FindPythonInterp
17-
# prefers the system Python instead of the executable from the python3
18-
# port.
19-
if(NOT CMAKE_CROSSCOMPILING)
20-
find_package(PythonInterp)
21-
endif()
22-
find_package(PythonLibs)
12+
# The purpose of this test is to ensure that we get the expected values
13+
# from the finders, not crosscompiling. So, let's not even go there.
14+
# These find_package() calls aren't required because FindPythonInterp
15+
# seems to not return a result in CI. Probably because FindPythonInterp
16+
# prefers the system Python instead of the executable from the python3
17+
# port.
18+
if(NOT CMAKE_CROSSCOMPILING)
19+
find_package(PythonInterp)
20+
endif()
21+
find_package(PythonLibs)
2322

24-
# The old find modules should NOT be prefixed.
25-
if(DEFINED PythonInterp_MEOW_FOUND OR DEFINED PYTHON_MEOW_EXECUTABLE)
26-
message(FATAL_ERROR "FindPythonInterp prefixed the result variables")
27-
endif()
28-
if(DEFINED PythonLibs_MEOW_FOUND OR DEFINED PYTHON_MEOW_LIBRARIES)
29-
message(FATAL_ERROR "FindPythonLibs prefixed the result variables")
23+
# The old find modules should NOT be prefixed.
24+
if(DEFINED PythonInterp_MEOW_FOUND OR DEFINED PYTHON_MEOW_EXECUTABLE)
25+
message(FATAL_ERROR "FindPythonInterp prefixed the result variables")
26+
endif()
27+
if(DEFINED PythonLibs_MEOW_FOUND OR DEFINED PYTHON_MEOW_LIBRARIES)
28+
message(FATAL_ERROR "FindPythonLibs prefixed the result variables")
29+
endif()
3030
endif()
3131

3232
function(test_result NAME TYPE EXPECTED UNEXPECTED)
@@ -55,13 +55,8 @@ endif()
5555

5656
# The new find modules should be prefixed if CMake is 4.0+
5757
find_package(Python REQUIRED COMPONENTS ${_INTERPRETER} Development)
58-
if(CMAKE_VERSION VERSION_GREATER_EQUAL 4.0)
59-
set(EXPECTED_PYTHON Python_MEOW)
60-
set(UNEXPECTED_PYTHON Python)
61-
else()
62-
set(EXPECTED_PYTHON Python)
63-
set(UNEXPECTED_PYTHON Python_MEOW)
64-
endif()
58+
set(EXPECTED_PYTHON Python)
59+
set(UNEXPECTED_PYTHON Python_MEOW)
6560
test_new_finder(${EXPECTED_PYTHON} ${UNEXPECTED_PYTHON})
6661

6762
# Also test non-prefixed. Use Python3:: to avoid conflicts with Python_MEOW::

0 commit comments

Comments
 (0)