findDependencies.cmake: use `FindPython` instead of deprecated `FindPythonInterp` (#5485)
This fixes the following warning with CMake 3.27: ``` CMake Warning (dev) at cmake/findDependencies.cmake:42 (find_package): Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules are removed. Run "cmake --help-policy CMP0148" for policy details. Use the cmake_policy command to set the policy and suppress this warning. Call Stack (most recent call first): CMakeLists.txt:15 (include) This warning is for project developers. Use -Wno-dev to suppress it. ```
This commit is contained in:
parent
e928f2b5aa
commit
ca20152e51
|
@ -39,13 +39,23 @@ endif()
|
|||
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
find_package(PythonInterp 3 QUIET)
|
||||
if (NOT PYTHONINTERP_FOUND)
|
||||
set(PYTHONINTERP_FOUND "")
|
||||
find_package(PythonInterp 2.7 QUIET)
|
||||
if (NOT PYTHONINTERP_FOUND AND NOT USE_MATCHCOMPILER_OPT STREQUAL "Off")
|
||||
if (CMAKE_VERSION VERSION_EQUAL "3.12" OR CMAKE_VERSION VERSION_GREATER "3.12")
|
||||
find_package(Python COMPONENTS Interpreter)
|
||||
if (NOT Python_Interpreter_FOUND)
|
||||
message(WARNING "No python interpreter found. Therefore, the match compiler is switched off.")
|
||||
set(USE_MATCHCOMPILER_OPT "Off")
|
||||
else()
|
||||
set(PYTHON_EXECUTABLE ${Python_EXECUTABLE})
|
||||
endif()
|
||||
else()
|
||||
find_package(PythonInterp 3 QUIET)
|
||||
if (NOT PYTHONINTERP_FOUND)
|
||||
set(PYTHONINTERP_FOUND "")
|
||||
find_package(PythonInterp 2.7 QUIET)
|
||||
if (NOT PYTHONINTERP_FOUND AND NOT USE_MATCHCOMPILER_OPT STREQUAL "Off")
|
||||
message(WARNING "No python interpreter found. Therefore, the match compiler is switched off.")
|
||||
set(USE_MATCHCOMPILER_OPT "Off")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
Loading…
Reference in New Issue