Skip to content

Commit 24f47c0

Browse files
committed
cmake: Attempt to find python interpreter only if BUILD_TESTING is ON
This commit also improves the message reported at configuration time: ``` [...] -- Build tests: ON -- Looking for Python >= 2.7 needed for summary tests -- Looking for Python >= 2.7 needed for summary tests - found (2.7.10) [...] ``` or ``` [...] -- Build tests: ON -- Looking for Python >= 2.7 needed for summary tests -- Looking for Python >= 2.7 needed for summary tests - not found (skipping summary tests) [...] ```
1 parent 15882de commit 24f47c0

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

CMakeLists.txt

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,8 @@ if(CMAKE_Fortran_COMPILER_ID STREQUAL "Compaq")
110110
endif()
111111
endif()
112112

113-
# Get Python
114-
message(STATUS "Looking for Python greater than 2.6 - ${PYTHONINTERP_FOUND}")
115-
find_package(PythonInterp 2.7) # lapack_testing.py uses features from python 2.7 and greater
116-
if(PYTHONINTERP_FOUND)
117-
message(STATUS "Using Python version ${PYTHON_VERSION_STRING}")
118-
else()
119-
message(STATUS "No suitable Python version found, so skipping summary tests.")
120-
endif()
121-
# --------------------------------------------------
122113

114+
# --------------------------------------------------
123115
set(LAPACK_INSTALL_EXPORT_NAME lapack-targets)
124116

125117
macro(lapack_install_library lib)
@@ -139,6 +131,18 @@ option(BUILD_TESTING "Build tests" ${_is_coverage_build})
139131
include(CTest)
140132
message(STATUS "Build tests: ${BUILD_TESTING}")
141133

134+
# lapack_testing.py uses features from python 2.7 and greater
135+
if(BUILD_TESTING)
136+
set(_msg "Looking for Python >= 2.7 needed for summary tests")
137+
message(STATUS "${_msg}")
138+
find_package(PythonInterp 2.7 QUIET)
139+
if(PYTHONINTERP_FOUND)
140+
message(STATUS "${_msg} - found (${PYTHON_VERSION_STRING})")
141+
else()
142+
message(STATUS "${_msg} - not found (skipping summary tests)")
143+
endif()
144+
endif()
145+
142146
# --------------------------------------------------
143147
# Organize output files. On Windows this also keeps .dll files next
144148
# to the .exe files that need them, making tests easy to run.

0 commit comments

Comments
 (0)