Skip to content

Commit 5276a67

Browse files
authored
Merge pull request #1248 from martin-frbg/cmake-findpython
Update the search strategy for a Python3 interpreter
2 parents eb4f2b1 + a53ab62 commit 5276a67

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

CMakeLists.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,10 @@ message(STATUS "Build tests: ${BUILD_TESTING}")
179179
if(BUILD_TESTING)
180180
set(_msg "Looking for Python3 needed for summary tests")
181181
message(STATUS "${_msg}")
182-
# find_package(PythonInterp 3) cannot be used because /usr/bin/python may be
183-
# a Python2 interpreter.
184-
find_program(PYTHON_EXECUTABLE python3)
185-
if(PYTHON_EXECUTABLE)
186-
message(STATUS "${_msg} - found")
182+
set(Python3_FIND_STRATEGY LOCATION)
183+
find_package(Python3 COMPONENTS Interpreter)
184+
if(Python3_Interpreter_FOUND )
185+
message(STATUS "${_msg} - found: ${Python3_VERSION}")
187186
else()
188187
message(STATUS "${_msg} - not found (skipping summary tests)")
189188
endif()

0 commit comments

Comments
 (0)