Changeset: 8c8f434132a2 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8c8f434132a2
Modified Files:
CMakeLists.txt
Branch: cmake-fun
Log Message:
Better way to check major python version.
diffs (29 lines):
diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -601,21 +601,18 @@ message(STATUS "Checking major version o
find_program(PYTHON_INTERPRETER python)
if(PYTHON_INTERPRETER)
exec_program("${PYTHON_INTERPRETER}" ARGS "-V" OUTPUT_VARIABLE
PY_OUPUT_RES RETURN_VALUE PY_RETURN_CODE)
+ string(REGEX REPLACE "Python *\([0-9]+\)\\.[0-9]+\\.[0-9]+" "\\1"
MAJOR_PYTHON "${PY_OUPUT_RES}")
if(PY_RETURN_CODE EQUAL 0 AND PY_OUPUT_RES)
- string(FIND "${PY_OUPUT_RES}" "Python 2" MAJOR_IS_PYTHON2)
- string(FIND "${PY_OUPUT_RES}" "Python 3" MAJOR_IS_PYTHON3)
- if(NOT MAJOR_IS_PYTHON2 EQUAL -1) # Python 2 has precedence
- set(MAJOR_PYTHON 2)
+ if("${MAJOR_PYTHON}" EQUAL "2") # Python 2 has precedence
set(HAVE_PYTHON2 YES)
set(PY2_OUPUT_RES "${PY_OUPUT_RES}")
- elseif(NOT MAJOR_IS_PYTHON3 EQUAL -1)
- set(MAJOR_PYTHON 3)
+ elseif("${MAJOR_PYTHON}" EQUAL "3")
set(HAVE_PYTHON3 YES)
set(PY3_OUPUT_RES "${PY_OUPUT_RES}")
else()
message(FATAL_ERROR "Only python versions 2 and 3 are
supported by MonetDB")
endif()
- if(MAJOR_IS_PYTHON2 OR MAJOR_IS_PYTHON3)
+ if(HAVE_PYTHON2 OR HAVE_PYTHON3)
set(HAVE_PYTHON YES)
message(STATUS "Major Python interpreter:
${MAJOR_PYTHON}")
endif()
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list