Skip to content

Commit

Permalink
Fix python3 finding on OSX with -DUSE_PYTHON_VERSION=3 (#529)
Browse files Browse the repository at this point in the history
  • Loading branch information
tribal-tec authored Dec 5, 2016
1 parent 0aff536 commit 3d5d284
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions ChoosePython.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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=''))"
Expand Down

0 comments on commit 3d5d284

Please sign in to comment.