mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-11 08:03:55 +00:00
improved python detection in CMakeLists.txt (fixes #98)
This commit is contained in:
parent
1f7a8096b7
commit
c91551b33b
@ -34,6 +34,8 @@ if (NOT ${PYBIND11_PYTHON_VERSION} STREQUAL "")
|
|||||||
else()
|
else()
|
||||||
find_package(PythonLibs REQUIRED)
|
find_package(PythonLibs REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
|
# The above sometimes returns version numbers like "3.4.3+"; the "+" must be removed for the next line to work
|
||||||
|
string(REPLACE "+" "" PYTHONLIBS_VERSION_STRING "+${PYTHONLIBS_VERSION_STRING}")
|
||||||
find_package(PythonInterp ${PYTHONLIBS_VERSION_STRING} EXACT REQUIRED)
|
find_package(PythonInterp ${PYTHONLIBS_VERSION_STRING} EXACT REQUIRED)
|
||||||
|
|
||||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||||
|
@ -38,6 +38,9 @@ and that the pybind11 repository is located in a subdirectory named :file:`pybin
|
|||||||
find_package(PythonLibs REQUIRED)
|
find_package(PythonLibs REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# The above sometimes returns version numbers like "3.4.3+"; the "+" must be removed for the next lines to work
|
||||||
|
string(REPLACE "+" "" PYTHONLIBS_VERSION_STRING "+${PYTHONLIBS_VERSION_STRING}")
|
||||||
|
|
||||||
# Uncomment the following line if you will also require a matching Python interpreter
|
# Uncomment the following line if you will also require a matching Python interpreter
|
||||||
# find_package(PythonInterp ${PYTHONLIBS_VERSION_STRING} EXACT REQUIRED)
|
# find_package(PythonInterp ${PYTHONLIBS_VERSION_STRING} EXACT REQUIRED)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user