Am Wed, 27 Nov 2019 18:09:44 +0100
schrieb pdv <pdvissch...@edpnet.be>:

> find_package(PythonInterp ...) is deprecated since CMake 3.12.
> 
> With the current master build on MacOS CMake returns 
> `Python3_EXECUTABLE=Python3.5` although Python3.7 is selected with macports.
> 
> Using the recommended find_package(Python3 ...) CMake returns 
> `Python3_EXECUTABLE=Python3.7`. (patch included)
> 
> Patrick

No need to query for LYX_PYTHON_EXECUTABLE  before calling the find_package().
Therefore the patch could be as in the attached.

BTW, I never saw any deprecated message ... only looking into 
FindPythonInterp.cmake
there is a hint.

        Kornel
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 779d9e932d..52290e8e36 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -790,21 +790,22 @@ endif()
 unset(PYTHON_EXECUTABLE CACHE)
 unset(LYX_PYTHON_EXECUTABLE CACHE)
 unset(PYTHON_VERSION_MAJOR)
 unset(PYTHON_VERSION_MINOR)
 unset(PYTHON_VERSION_STRING)
-find_package(PythonInterp 3.5 QUIET)
-if(NOT PYTHONINTERP_FOUND)
+find_package(Python3 3.5 QUIET)
+if(NOT Python3_Interpreter_FOUND)
   unset(PYTHON_EXECUTABLE CACHE)
-  find_package(PythonInterp 2.0 REQUIRED)
+  find_package(Python2 2.0 REQUIRED)
   if(NOT PYTHON_VERSION_STRING VERSION_LESS 2.8)
     message(FATAL_ERROR "Python interpreter found, but is not suitable")
   endif()
+  set(LYX_PYTHON_EXECUTABLE ${Python2_EXECUTABLE} CACHE FILEPATH "Python to be used by LyX")
+else()
+  set(LYX_PYTHON_EXECUTABLE ${Python3_EXECUTABLE} CACHE FILEPATH "Python to be used by LyX")
 endif()
 
-set(LYX_PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "Python to be used by LyX")
-
 if(LYX_NLS)
 	find_package(LyXGettext)
 	if(LYX_PYTHON_EXECUTABLE AND GETTEXT_FOUND)
 		add_subdirectory(po "${TOP_BINARY_DIR}/po")
 	else()

Attachment: pgpDQA7gHzBXD.pgp
Description: Digitale Signatur von OpenPGP

-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to