From 3453c0815f87d4ad6a6dd897fc5a4cdc711285c0 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Sun, 30 Oct 2016 11:19:43 +0300 Subject: [PATCH] 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. --- CMakeLists.txt | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ec647fd2..1b7a36a2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() -- 2.50.1