Skip to content

Commit b59c2e5

Browse files
committed
Adopt CMP0148: Remove Deprecated PythonInterp
CMake deprecated the PythonInterp package a while ago now, so running `find_package(PythonInterp)` emits warnings saying that it's being removed. This patch switches to the newer `Python3` package. The llvm-lit binary makes use of newer language features that are only available in Python 3.7 and newer, so I've also bumped the minimum required Python version to avoid issues there.
1 parent a4a5c41 commit b59c2e5

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ set(LLBUILD_LIBDIR_SUFFIX "${LIB_SUFFIX}" CACHE STRING "Set default library fold
8888
if(BUILD_TESTING)
8989
find_package(Lit)
9090
find_package(FileCheck)
91-
find_package(PythonInterp)
91+
find_package(Python3 3.7 COMPONENTS Interpreter)
9292
endif()
9393

9494
###

tests/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ configure_file(
1818
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
1919
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg)
2020

21-
include(FindPython)
22-
if(Python_Interpreter_FOUND AND LIT_FOUND AND FILECHECK_FOUND)
21+
if(Python3_Interpreter_FOUND AND LIT_FOUND AND FILECHECK_FOUND)
2322
set(LIT_ARGS "${LLBUILD_LIT_ARGS}")
2423
separate_arguments(LIT_ARGS)
2524

@@ -29,7 +28,7 @@ if(Python_Interpreter_FOUND AND LIT_FOUND AND FILECHECK_FOUND)
2928
endif()
3029

3130
set(lit_command
32-
${Python_EXECUTABLE}
31+
${Python3_EXECUTABLE}
3332
${LIT_EXECUTABLE}
3433
${LIT_ARGS}
3534
--param build_mode=${build_mode})

0 commit comments

Comments
 (0)