-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Description
I want to built a python module with pybind11 and CMake. At the moment Python 2.7 should be used.
I'm on Kubuntu 16.04, CMake 3.6, pybind11 2.0.0.
The CMake snippet I use is:
set(PYBIND11_PYTHON_VERSION 2.7)
add_subdirectory(../../pybind11-2.0.0 ${CMAKE_BINARY_DIR}/pybind11)
[...]
pybind11_add_module([...])
[...]
Note, that pybind is not a subdirectory, but located somewhere else in the repo.
In the CMake output I get something like:
-- Found PythonInterp: /usr/bin/python3.5 (found version "3.5.2")
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.5m.so
Python 3.5 is used even if I set PYBIND11_PYTHON_VERSION to 2.7.
I digged into the CMake files of pybind11 and found the following in pybind11Tools.cmake:
set(Python_ADDITIONAL_VERSIONS 3.7 3.6 3.5 3.4)
find_package(PythonLibsNew ${PYBIND11_PYTHON_VERSION} REQUIRED)
And in FindPythonLibsNew.cmake:
if(PythonLibsNew_FIND_REQUIRED)
find_package(PythonInterp ${PythonLibsNew_FIND_VERSION} REQUIRED)
else()
find_package(PythonInterp ${PythonLibsNew_FIND_VERSION})
endif()
The docs to FindPythonInterp states, that "The Python_ADDITIONAL_VERSIONS variable can be used to specify a list of version numbers that should be taken into account when searching for Python".
Is pybind11 2.0.0 only for Python version 3.4 and above?
Metadata
Metadata
Assignees
Labels
No labels