diff options
author | Marius Brehler <marius.brehler@iml.fraunhofer.de> | 2020-11-11 15:12:11 (GMT) |
---|---|---|
committer | Marius Brehler <marius.brehler@iml.fraunhofer.de> | 2020-11-11 15:12:11 (GMT) |
commit | 826e9f25a15e550d2a6992f5bee1f90b801178b2 (patch) | |
tree | 78d26c4408b334a365ed7c8df8cda492787ca1b2 | |
parent | 035de8c7fde74a07190f20439169fdeb867c13ac (diff) | |
download | googletest-826e9f25a15e550d2a6992f5bee1f90b801178b2.zip googletest-826e9f25a15e550d2a6992f5bee1f90b801178b2.tar.gz googletest-826e9f25a15e550d2a6992f5bee1f90b801178b2.tar.bz2 |
Refactor finding pythonrefs/pull/3114/head
Use `find_package(Python ..)` if available, instead of the deprecated
`find_package(PythonInterp)` CMake module.
-rw-r--r-- | googletest/cmake/internal_utils.cmake | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake index b3e8b81..d6a5112 100644 --- a/googletest/cmake/internal_utils.cmake +++ b/googletest/cmake/internal_utils.cmake @@ -244,7 +244,13 @@ function(cxx_executable name dir libs) endfunction() # Sets PYTHONINTERP_FOUND and PYTHON_EXECUTABLE. -find_package(PythonInterp) +if ("${CMAKE_VERSION}" VERSION_LESS "3.12.0") + find_package(PythonInterp) +else() + find_package(Python COMPONENTS Interpreter) + set(PYTHONINTERP_FOUND ${Python_Interpreter_FOUND}) + set(PYTHON_EXECUTABLE ${Python_EXECUTABLE}) +endif() # cxx_test_with_flags(name cxx_flags libs srcs...) # |