Cmake build: Prefer using pyton3 over python2

This commit is contained in:
Kornel Benko 2017-04-24 17:48:59 +02:00
parent fb79d6ed4f
commit 0f3b1539e8

View File

@ -729,19 +729,19 @@ if(GNUWIN32_DIR)
list(APPEND CMAKE_PROGRAM_PATH "${GNUWIN32_DIR}/Python" ) list(APPEND CMAKE_PROGRAM_PATH "${GNUWIN32_DIR}/Python" )
endif() endif()
find_package(PythonInterp 2.7 QUIET) # Search for python default version first
if(PYTHONINTERP_FOUND)
if(PYTHON_VERSION_STRING VERSION_GREATER 2.8)
unset(PYTHONINTERP_FOUND)
endif()
endif()
if(NOT PYTHONINTERP_FOUND)
unset(PYTHON_EXECUTABLE CACHE) unset(PYTHON_EXECUTABLE CACHE)
unset(LYX_PYTHON_EXECUTABLE CACHE)
unset(PYTHON_VERSION_MAJOR) unset(PYTHON_VERSION_MAJOR)
unset(PYTHON_VERSION_MINOR) unset(PYTHON_VERSION_MINOR)
unset(PYTHON_VERSION_STRING) unset(PYTHON_VERSION_STRING)
find_package(PythonInterp 3.3 REQUIRED) find_package(PythonInterp 3.3 QUIET)
if(NOT PYTHONINTERP_FOUND)
unset(PYTHON_EXECUTABLE CACHE)
find_package(PythonInterp 2.0 REQUIRED)
if(NOT PYTHON_VERSION_STRING VERSION_LESS 2.8)
message(FATAL_ERROR "Python interpreter found, but is not suitable")
endif()
endif() endif()
set(LYX_PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "Python to be used by LyX") set(LYX_PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "Python to be used by LyX")