Skip to content

Commit 5e3f64b

Browse files
committed
COMP: fix CMake configure error when Python is not found
If Python is not found, PYTHON_VERSION_STRING is empty causing: CMake Error at src/CMakeLists.txt:26 (if): if given arguments: "VERSION_LESS" "2.7" Unknown arguments specified
1 parent e5f6d08 commit 5e3f64b

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/CMakeLists.txt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,15 @@ endif()
1919

2020
if(BUILD_DOCUMENTATION)
2121
find_package(PythonInterp REQUIRED)
22-
23-
# Set here the proper version of Python required to be able to build
24-
# tarballs for each example
25-
set(PYTHON_REQUIRED_VERSION 2.7)
26-
if(${PYTHON_VERSION_STRING} VERSION_LESS ${PYTHON_REQUIRED_VERSION})
27-
message(SEND_ERROR "Building the documentation requires Python >= ${PYTHON_REQUIRED_VERSION}")
22+
if(NOT PYTHONINTERP_FOUND)
23+
message(SEND_ERROR "Building the documentation requires Python")
24+
else()
25+
# Set here the proper version of Python required to be able to build
26+
# tarballs for each example
27+
set(PYTHON_REQUIRED_VERSION 2.7)
28+
if(${PYTHON_VERSION_STRING} VERSION_LESS ${PYTHON_REQUIRED_VERSION})
29+
message(SEND_ERROR "Building the documentation requires Python >= ${PYTHON_REQUIRED_VERSION}")
30+
endif()
2831
endif()
2932
endif()
3033

0 commit comments

Comments
 (0)