mirror of
https://github.com/pybind/pybind11.git
synced 2025-02-20 07:30:40 +00:00
fix: use FindPython for CMake 3.18+ by default for pybind11's tests
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
This commit is contained in:
parent
abb4e8b120
commit
88fc7e1275
@ -92,9 +92,15 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
|
|||||||
set(pybind11_system "")
|
set(pybind11_system "")
|
||||||
|
|
||||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||||
|
if(CMAKE_VERSION VERSION_LESS "3.18")
|
||||||
|
set(_pybind11_findpython_default OFF)
|
||||||
|
else()
|
||||||
|
set(_pybind11_findpython_default ON)
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
set(PYBIND11_MASTER_PROJECT OFF)
|
set(PYBIND11_MASTER_PROJECT OFF)
|
||||||
set(pybind11_system SYSTEM)
|
set(pybind11_system SYSTEM)
|
||||||
|
set(_pybind11_findpython_default OFF)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Options
|
# Options
|
||||||
@ -116,9 +122,20 @@ cmake_dependent_option(
|
|||||||
"Install pybind11 headers in Python include directory instead of default installation prefix"
|
"Install pybind11 headers in Python include directory instead of default installation prefix"
|
||||||
OFF "PYBIND11_INSTALL" OFF)
|
OFF "PYBIND11_INSTALL" OFF)
|
||||||
|
|
||||||
cmake_dependent_option(PYBIND11_FINDPYTHON "Force new FindPython" OFF
|
cmake_dependent_option(PYBIND11_FINDPYTHON "Force new FindPython" ${_pybind11_findpython_default}
|
||||||
"NOT CMAKE_VERSION VERSION_LESS 3.12" OFF)
|
"NOT CMAKE_VERSION VERSION_LESS 3.12" OFF)
|
||||||
|
|
||||||
|
# Allow PYTHON_EXECUTABLE if in FINDPYTHON mode and building pybind11's tests
|
||||||
|
# (makes transition easier while we support both modes).
|
||||||
|
if(PYBIND11_MASTER_PROJECT
|
||||||
|
AND PYBIND11_FINDPYTHON
|
||||||
|
AND DEFINED PYTHON_EXECUTABLE
|
||||||
|
AND NOT DEFINED Python_EXECUTABLE)
|
||||||
|
set(Python_EXECUTABLE
|
||||||
|
"${PYTHON_EXECUTABLE}"
|
||||||
|
CACHE INTERNAL "")
|
||||||
|
endif()
|
||||||
|
|
||||||
# NB: when adding a header don't forget to also add it to setup.py
|
# NB: when adding a header don't forget to also add it to setup.py
|
||||||
set(PYBIND11_HEADERS
|
set(PYBIND11_HEADERS
|
||||||
include/pybind11/detail/class.h
|
include/pybind11/detail/class.h
|
||||||
|
Loading…
Reference in New Issue
Block a user