summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2022-04-21 18:08:29 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2022-04-21 18:23:36 (GMT)
commit313ea361b0435b18e89fb652bf59a8aef25a066b (patch)
treed0a6ea4e46ab2e64cfe81518b0cb7497e94efc1a
parentb6a6190877ebc6098fd01fe34dcd4cca39e1f182 (diff)
downloadCMake-313ea361b0435b18e89fb652bf59a8aef25a066b.zip
CMake-313ea361b0435b18e89fb652bf59a8aef25a066b.tar.gz
CMake-313ea361b0435b18e89fb652bf59a8aef25a066b.tar.bz2
CMake: Use FindPython instead of FindPythonInterp to build CMake itself
Fixes: #23444
-rw-r--r--Tests/RunCMake/CMakeLists.txt16
-rw-r--r--Tests/RunCMake/CMakePresets/check.cmake2
-rw-r--r--Tests/RunCMake/CMakePresets/validate_schema.cmake2
-rw-r--r--Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/CommandLine/trace-json-v1-check.cmake4
-rw-r--r--Tests/RunCMake/CommandLine/trace-json-v1-expand-check.cmake4
-rw-r--r--Tests/RunCMake/FileAPI/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/execute_process/AnyCommandAbnormalExit.cmake2
-rw-r--r--Tests/RunCMake/execute_process/LastCommandAbnormalExit-1.cmake4
-rw-r--r--Tests/RunCMake/execute_process/LastCommandAbnormalExit-2.cmake4
-rw-r--r--Tests/RunCMake/execute_process/RunCMakeTest.cmake8
-rw-r--r--Utilities/Release/win/x86/cache-i386.txt2
-rw-r--r--Utilities/Release/win/x86/cache-x86_64.txt2
-rw-r--r--Utilities/Sphinx/CMakeLists.txt4
14 files changed, 31 insertions, 31 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 024c388..c2677a0 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -76,7 +76,7 @@ function(add_RunCMake_test_group test types)
endfunction()
# Some tests use python for extra checks.
-find_package(PythonInterp QUIET)
+find_package(Python QUIET)
if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 6.1)
set(Swift_ARGS -DXCODE_BELOW_6_1=1)
@@ -302,7 +302,7 @@ add_RunCMake_test(ExcludeFromAll)
add_RunCMake_test(ExternalData)
add_RunCMake_test(FeatureSummary)
add_RunCMake_test(FPHSA)
-add_RunCMake_test(FileAPI -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
+add_RunCMake_test(FileAPI -DPython_EXECUTABLE=${Python_EXECUTABLE}
-DCMAKE_CXX_COMPILER_ID=${CMAKE_CXX_COMPILER_ID})
add_RunCMake_test(FindBoost)
add_RunCMake_test(FindLua)
@@ -400,7 +400,7 @@ add_RunCMake_test(build_command)
add_executable(exit_code exit_code.c)
set(execute_process_ARGS
-DEXIT_CODE_EXE=$<TARGET_FILE:exit_code>
- -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
+ -DPython_EXECUTABLE=${Python_EXECUTABLE}
)
if(NOT CMake_TEST_EXTERNAL_CMAKE)
list(APPEND execute_process_ARGS -DTEST_ENCODING_EXE=$<TARGET_FILE:testEncoding>)
@@ -748,7 +748,7 @@ endif()
add_executable(pseudo_llvm-rc pseudo_llvm-rc.c)
add_RunCMake_test(CommandLine -DLLVM_RC=$<TARGET_FILE:pseudo_llvm-rc> -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
- -DCYGWIN=${CYGWIN} -DMSYS=${MSYS} -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
+ -DCYGWIN=${CYGWIN} -DMSYS=${MSYS} -DPython_EXECUTABLE=${Python_EXECUTABLE}
-DEXIT_CODE_EXE=$<TARGET_FILE:exit_code>)
add_RunCMake_test(CommandLineTar)
@@ -784,7 +784,7 @@ if(CMake_TEST_RunCMake_ExternalProject_DOWNLOAD_SERVER_TIMEOUT)
endif()
add_RunCMake_test(ExternalProject)
add_RunCMake_test(FetchContent)
-set(CTestCommandLine_ARGS -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE})
+set(CTestCommandLine_ARGS -DPython_EXECUTABLE=${Python_EXECUTABLE})
if(NOT CMake_TEST_EXTERNAL_CMAKE)
list(APPEND CTestCommandLine_ARGS -DTEST_AFFINITY=$<TARGET_FILE:testAffinity>)
endif()
@@ -968,16 +968,16 @@ add_RunCMake_test(PrecompileHeaders -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}
add_RunCMake_test("UnityBuild")
add_RunCMake_test(CMakePresets
- -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
+ -DPython_EXECUTABLE=${Python_EXECUTABLE}
-DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA}
)
add_RunCMake_test(CMakePresetsBuild
- -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
+ -DPython_EXECUTABLE=${Python_EXECUTABLE}
-DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA}
-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
)
add_RunCMake_test(CMakePresetsTest
- -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
+ -DPython_EXECUTABLE=${Python_EXECUTABLE}
-DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA}
)
diff --git a/Tests/RunCMake/CMakePresets/check.cmake b/Tests/RunCMake/CMakePresets/check.cmake
index cef43f4..03f96a9 100644
--- a/Tests/RunCMake/CMakePresets/check.cmake
+++ b/Tests/RunCMake/CMakePresets/check.cmake
@@ -1,4 +1,4 @@
-if(PYTHON_EXECUTABLE AND CMake_TEST_JSON_SCHEMA)
+if(Python_EXECUTABLE AND CMake_TEST_JSON_SCHEMA)
if(NOT CMakePresets_SCHEMA_EXPECTED_RESULT)
set(CMakePresets_SCHEMA_EXPECTED_RESULT 0)
endif()
diff --git a/Tests/RunCMake/CMakePresets/validate_schema.cmake b/Tests/RunCMake/CMakePresets/validate_schema.cmake
index 68b638f..ed60760 100644
--- a/Tests/RunCMake/CMakePresets/validate_schema.cmake
+++ b/Tests/RunCMake/CMakePresets/validate_schema.cmake
@@ -4,7 +4,7 @@ function(validate_schema file expected_result)
endif()
execute_process(
- COMMAND "${PYTHON_EXECUTABLE}" "${CMakePresets_VALIDATE_SCRIPT_PATH}" "${file}"
+ COMMAND "${Python_EXECUTABLE}" "${CMakePresets_VALIDATE_SCRIPT_PATH}" "${file}"
RESULT_VARIABLE _result
OUTPUT_VARIABLE _output
ERROR_VARIABLE _error
diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
index 6835834..8ac1747 100644
--- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
@@ -342,14 +342,14 @@ endfunction()
run_TestStdin()
function(show_only_json_check_python v)
- if(RunCMake_TEST_FAILED OR NOT PYTHON_EXECUTABLE)
+ if(RunCMake_TEST_FAILED OR NOT Python_EXECUTABLE)
return()
endif()
set(json_file "${RunCMake_TEST_BINARY_DIR}/ctest.json")
file(WRITE "${json_file}" "${actual_stdout}")
set(actual_stdout "" PARENT_SCOPE)
execute_process(
- COMMAND ${PYTHON_EXECUTABLE} "${RunCMake_SOURCE_DIR}/show-only_json-v${v}_check.py" "${json_file}"
+ COMMAND ${Python_EXECUTABLE} "${RunCMake_SOURCE_DIR}/show-only_json-v${v}_check.py" "${json_file}"
RESULT_VARIABLE result
OUTPUT_VARIABLE output
ERROR_VARIABLE output
diff --git a/Tests/RunCMake/CommandLine/trace-json-v1-check.cmake b/Tests/RunCMake/CommandLine/trace-json-v1-check.cmake
index 66af039..e9a4a59 100644
--- a/Tests/RunCMake/CommandLine/trace-json-v1-check.cmake
+++ b/Tests/RunCMake/CommandLine/trace-json-v1-check.cmake
@@ -1,6 +1,6 @@
-if(PYTHON_EXECUTABLE)
+if(Python_EXECUTABLE)
execute_process(
- COMMAND ${PYTHON_EXECUTABLE} "${RunCMake_SOURCE_DIR}/trace-json-v1-check.py" "${RunCMake_BINARY_DIR}/json-v1.trace"
+ COMMAND ${Python_EXECUTABLE} "${RunCMake_SOURCE_DIR}/trace-json-v1-check.py" "${RunCMake_BINARY_DIR}/json-v1.trace"
RESULT_VARIABLE result
OUTPUT_VARIABLE output
ERROR_VARIABLE output
diff --git a/Tests/RunCMake/CommandLine/trace-json-v1-expand-check.cmake b/Tests/RunCMake/CommandLine/trace-json-v1-expand-check.cmake
index 7916d2e..79079e1 100644
--- a/Tests/RunCMake/CommandLine/trace-json-v1-expand-check.cmake
+++ b/Tests/RunCMake/CommandLine/trace-json-v1-expand-check.cmake
@@ -1,6 +1,6 @@
-if(PYTHON_EXECUTABLE)
+if(Python_EXECUTABLE)
execute_process(
- COMMAND ${PYTHON_EXECUTABLE} "${RunCMake_SOURCE_DIR}/trace-json-v1-check.py" --expand "${RunCMake_BINARY_DIR}/json-v1-expand.trace"
+ COMMAND ${Python_EXECUTABLE} "${RunCMake_SOURCE_DIR}/trace-json-v1-check.py" --expand "${RunCMake_BINARY_DIR}/json-v1-expand.trace"
RESULT_VARIABLE result
OUTPUT_VARIABLE output
ERROR_VARIABLE output
diff --git a/Tests/RunCMake/FileAPI/RunCMakeTest.cmake b/Tests/RunCMake/FileAPI/RunCMakeTest.cmake
index ae3d179..61dce17 100644
--- a/Tests/RunCMake/FileAPI/RunCMakeTest.cmake
+++ b/Tests/RunCMake/FileAPI/RunCMakeTest.cmake
@@ -18,12 +18,12 @@ in directory:
endfunction()
function(check_python case)
- if(RunCMake_TEST_FAILED OR NOT PYTHON_EXECUTABLE)
+ if(RunCMake_TEST_FAILED OR NOT Python_EXECUTABLE)
return()
endif()
file(GLOB index ${RunCMake_TEST_BINARY_DIR}/.cmake/api/v1/reply/index-*.json)
execute_process(
- COMMAND ${PYTHON_EXECUTABLE} "${RunCMake_SOURCE_DIR}/${case}-check.py" "${index}" "${CMAKE_CXX_COMPILER_ID}"
+ COMMAND ${Python_EXECUTABLE} "${RunCMake_SOURCE_DIR}/${case}-check.py" "${index}" "${CMAKE_CXX_COMPILER_ID}"
"${RunCMake_TEST_BINARY_DIR}"
RESULT_VARIABLE result
OUTPUT_VARIABLE output
diff --git a/Tests/RunCMake/execute_process/AnyCommandAbnormalExit.cmake b/Tests/RunCMake/execute_process/AnyCommandAbnormalExit.cmake
index 5ac0c21..1017e0f 100644
--- a/Tests/RunCMake/execute_process/AnyCommandAbnormalExit.cmake
+++ b/Tests/RunCMake/execute_process/AnyCommandAbnormalExit.cmake
@@ -1,4 +1,4 @@
-execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c
+execute_process(COMMAND "${Python_EXECUTABLE}" -c
"import os; os.kill(os.getpid(),11)"
COMMAND ${CMAKE_COMMAND} -E true
COMMAND_ERROR_IS_FATAL ANY
diff --git a/Tests/RunCMake/execute_process/LastCommandAbnormalExit-1.cmake b/Tests/RunCMake/execute_process/LastCommandAbnormalExit-1.cmake
index 5a4574c..e4a125d 100644
--- a/Tests/RunCMake/execute_process/LastCommandAbnormalExit-1.cmake
+++ b/Tests/RunCMake/execute_process/LastCommandAbnormalExit-1.cmake
@@ -1,11 +1,11 @@
-execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c
+execute_process(COMMAND "${Python_EXECUTABLE}" -c
"import os; os.kill(os.getpid(),11)"
COMMAND ${CMAKE_COMMAND} -E true
RESULT_VARIABLE result
)
if(result EQUAL "0")
- execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c
+ execute_process(COMMAND "${Python_EXECUTABLE}" -c
"import os; os.kill(os.getpid(),11)"
COMMAND ${CMAKE_COMMAND} -E true
COMMAND_ERROR_IS_FATAL LAST
diff --git a/Tests/RunCMake/execute_process/LastCommandAbnormalExit-2.cmake b/Tests/RunCMake/execute_process/LastCommandAbnormalExit-2.cmake
index b87e0f7..6c3fbf8 100644
--- a/Tests/RunCMake/execute_process/LastCommandAbnormalExit-2.cmake
+++ b/Tests/RunCMake/execute_process/LastCommandAbnormalExit-2.cmake
@@ -1,12 +1,12 @@
execute_process(COMMAND ${CMAKE_COMMAND} -E true
- COMMAND "${PYTHON_EXECUTABLE}" -c
+ COMMAND "${Python_EXECUTABLE}" -c
"import os; os.kill(os.getpid(),11)"
RESULT_VARIABLE result
)
if(NOT result EQUAL "0")
execute_process(COMMAND ${CMAKE_COMMAND} -E true
- COMMAND "${PYTHON_EXECUTABLE}" -c
+ COMMAND "${Python_EXECUTABLE}" -c
"import os; os.kill(os.getpid(),11)"
COMMAND_ERROR_IS_FATAL LAST
)
diff --git a/Tests/RunCMake/execute_process/RunCMakeTest.cmake b/Tests/RunCMake/execute_process/RunCMakeTest.cmake
index 35712f6..c2f9144 100644
--- a/Tests/RunCMake/execute_process/RunCMakeTest.cmake
+++ b/Tests/RunCMake/execute_process/RunCMakeTest.cmake
@@ -35,8 +35,8 @@ run_cmake_command(LastCommandError ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/La
run_cmake_command(LastCommandTimeout ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/LastCommandTimeout.cmake)
run_cmake_command(LastCommandGood ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/LastCommandGood.cmake)
-if(UNIX AND PYTHON_EXECUTABLE)
- run_cmake_command(AnyCommandAbnormalExit ${CMAKE_COMMAND} -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} -P ${RunCMake_SOURCE_DIR}/AnyCommandAbnormalExit.cmake)
- run_cmake_command(LastCommandAbnormalExit-1 ${CMAKE_COMMAND} -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} -P ${RunCMake_SOURCE_DIR}/LastCommandAbnormalExit-1.cmake)
- run_cmake_command(LastCommandAbnormalExit-2 ${CMAKE_COMMAND} -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} -P ${RunCMake_SOURCE_DIR}/LastCommandAbnormalExit-2.cmake)
+if(UNIX AND Python_EXECUTABLE)
+ run_cmake_command(AnyCommandAbnormalExit ${CMAKE_COMMAND} -DPython_EXECUTABLE=${Python_EXECUTABLE} -P ${RunCMake_SOURCE_DIR}/AnyCommandAbnormalExit.cmake)
+ run_cmake_command(LastCommandAbnormalExit-1 ${CMAKE_COMMAND} -DPython_EXECUTABLE=${Python_EXECUTABLE} -P ${RunCMake_SOURCE_DIR}/LastCommandAbnormalExit-1.cmake)
+ run_cmake_command(LastCommandAbnormalExit-2 ${CMAKE_COMMAND} -DPython_EXECUTABLE=${Python_EXECUTABLE} -P ${RunCMake_SOURCE_DIR}/LastCommandAbnormalExit-2.cmake)
endif()
diff --git a/Utilities/Release/win/x86/cache-i386.txt b/Utilities/Release/win/x86/cache-i386.txt
index 31c89ce..7f58fdd 100644
--- a/Utilities/Release/win/x86/cache-i386.txt
+++ b/Utilities/Release/win/x86/cache-i386.txt
@@ -19,7 +19,7 @@ CMake_QT_STATIC_QWindowsIntegrationPlugin_LIBRARIES:STRING=c:/qt-i386/plugins/pl
# Build documentation.
CMAKE_DOC_DIR:STRING=doc/cmake
-PYTHON_EXECUTABLE:FILEPATH=C:/python3/python.exe
+Python_EXECUTABLE:FILEPATH=C:/python3/python.exe
SPHINX_EXECUTABLE:FILEPATH=C:/python3/Scripts/sphinx-build.exe
SPHINX_HTML:BOOL=ON
SPHINX_MAN:BOOL=ON
diff --git a/Utilities/Release/win/x86/cache-x86_64.txt b/Utilities/Release/win/x86/cache-x86_64.txt
index b1e8dc1..d034640 100644
--- a/Utilities/Release/win/x86/cache-x86_64.txt
+++ b/Utilities/Release/win/x86/cache-x86_64.txt
@@ -19,7 +19,7 @@ CMake_QT_STATIC_QWindowsIntegrationPlugin_LIBRARIES:STRING=c:/qt-x86_64/plugins/
# Build documentation.
CMAKE_DOC_DIR:STRING=doc/cmake
-PYTHON_EXECUTABLE:FILEPATH=C:/python3/python.exe
+Python_EXECUTABLE:FILEPATH=C:/python3/python.exe
SPHINX_EXECUTABLE:FILEPATH=C:/python3/Scripts/sphinx-build.exe
SPHINX_HTML:BOOL=ON
SPHINX_MAN:BOOL=ON
diff --git a/Utilities/Sphinx/CMakeLists.txt b/Utilities/Sphinx/CMakeLists.txt
index 1259748..c698e3b 100644
--- a/Utilities/Sphinx/CMakeLists.txt
+++ b/Utilities/Sphinx/CMakeLists.txt
@@ -101,7 +101,7 @@ if(SPHINX_INFO)
)
endif()
if(SPHINX_QTHELP)
- find_package(PythonInterp REQUIRED)
+ find_package(Python REQUIRED)
find_program(QHELPGENERATOR_EXECUTABLE
NAMES qhelpgenerator-qt5 qhelpgenerator
@@ -124,7 +124,7 @@ if(SPHINX_QTHELP)
# Create proper identifiers. Workaround for
# https://bitbucket.org/birkenfeld/sphinx/issue/1491/qthelp-should-generate-identifiers-for
- COMMAND "${PYTHON_EXECUTABLE}"
+ COMMAND "${Python_EXECUTABLE}"
"${CMAKE_CURRENT_SOURCE_DIR}/create_identifiers.py"
"${CMAKE_CURRENT_BINARY_DIR}/qthelp/"