cmake: fix finding python2, and check that it is really 2

python version check removed in a4d044c0cd97f68b4b3dde414b83d609719d33d7
("cmake: use PYTHON_EXECUTABLE to find python2"), but in
bcb990ab7cf4921c2c30a1aa4fcb4c0131fffe94 ("cmake/win32: fix running
regress, but fixing finding python2 interpreter") we set
PYTHON_EXECUTABLE only if it exists.
This commit is contained in:
Azat Khuzhin 2016-10-30 11:19:43 +03:00
parent 8fb08ae924
commit 3453c0815f

View File

@ -943,14 +943,18 @@ if (NOT EVENT__DISABLE_TESTS)
#
if (NOT EVENT__DISABLE_REGRESS)
# (We require python to generate the regress tests)
find_program(FIND_PYTHON2 python2)
if (FIND_PYTHON2)
set(PYTHON_EXECUTABLE "python2")
endif()
# (We require python2 to generate the regress tests)
foreach (PY python2.6 python2.7 python2)
unset(FIND_PYTHON2 CACHE)
find_program(FIND_PYTHON2 ${PY})
if (FIND_PYTHON2)
set(PYTHON_EXECUTABLE "${PY}")
break()
endif()
endforeach()
find_package(PythonInterp)
if (PYTHONINTERP_FOUND)
if (PYTHONINTERP_FOUND AND PYTHON_VERSION_STRING VERSION_LESS "3.0.0")
set(__FOUND_USABLE_PYTHON 1)
endif()