mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 13:15:12 +00:00
Make Python version selection in CMake more convenient (#589)
This way a non-CACHE variable can also be used. For example: ``` set(PYBIND11_PYTHON_VERSION <value>) add_subdirectory(...) ```
This commit is contained in:
parent
a9730be73c
commit
5b5e3de369
@ -8,7 +8,9 @@
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
# Add a CMake parameter for choosing a desired Python version
|
||||
set(PYBIND11_PYTHON_VERSION "" CACHE STRING "Python version to use for compiling modules")
|
||||
if(NOT PYBIND11_PYTHON_VERSION)
|
||||
set(PYBIND11_PYTHON_VERSION "" CACHE STRING "Python version to use for compiling modules")
|
||||
endif()
|
||||
|
||||
set(Python_ADDITIONAL_VERSIONS 3.7 3.6 3.5 3.4)
|
||||
find_package(PythonLibsNew ${PYBIND11_PYTHON_VERSION} REQUIRED)
|
||||
|
Loading…
Reference in New Issue
Block a user