From 3d5d284949199e930805f767b729b0eec95b130b Mon Sep 17 00:00:00 2001 From: Daniel Nachbaur Date: Mon, 5 Dec 2016 15:54:16 +0100 Subject: [PATCH] Fix python3 finding on OSX with -DUSE_PYTHON_VERSION=3 (#529) --- CHANGES.md | 2 ++ ChoosePython.cmake | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 9db167d..424e34d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,8 @@ # 2016.12(09-Dec-2016) +* [529](https://github.com/Eyescale/CMake/pull/529): + Fix python3 finding on OSX with -DUSE_PYTHON_VERSION=3 * [527](https://github.com/Eyescale/CMake/pull/527): Refactor INSTALL_PACKAGES out of SubProject.cmake, also fixing a bug that the dependencies of a project were not installed if it did not have a diff --git a/ChoosePython.cmake b/ChoosePython.cmake index 1b21d51..0a6a728 100644 --- a/ChoosePython.cmake +++ b/ChoosePython.cmake @@ -79,7 +79,6 @@ if(${USE_PYTHON_VERSION} STREQUAL 3) set(PYTHON_ADDITIONAL_VERSIONS 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2) set(Python_ADDITIONAL_VERSIONS 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2) set(PythonLibs_FIND_VERSION 3) - set(PythonInterp_FIND_VERSION 3) add_definitions(-DUSE_PYTHON3=1) set(USE_BOOST_PYTHON_VERSION ${__boost_python_library_suffix}) # This shouldn't be necessary but helps detecting the Python libs @@ -94,13 +93,12 @@ if(${USE_PYTHON_VERSION} STREQUAL 3) endif() else() set(PythonLibs_FIND_VERSION 2) - set(PythonInterp_FIND_VERSION 2) endif() if(NOT PYTHON_EXECUTABLE) # Regardless of auto-detection, now we need to find the interpreter to # query the library suffix. - find_package(PythonInterp QUIET) + find_package(PythonInterp ${USE_PYTHON_VERSION} QUIET) endif() execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1,0,prefix=''))"