feat: FindPython by default (#5553)

* feat: FindPython by default

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Update tools/pybind11Config.cmake.in

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
This commit is contained in:
Henry Schreiner
2025-03-11 18:10:26 -04:00
committed by GitHub
parent 06e8ee2e35
commit d28904f12e
4 changed files with 33 additions and 6 deletions

View File

@@ -81,7 +81,7 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
else()
set(PYBIND11_MASTER_PROJECT OFF)
set(pybind11_system SYSTEM)
set(_pybind11_findpython_default OFF)
set(_pybind11_findpython_default COMPAT)
endif()
# Options
@@ -114,7 +114,9 @@ cmake_dependent_option(
"Install pybind11 headers in Python include directory instead of default installation prefix"
OFF "PYBIND11_INSTALL" OFF)
option(PYBIND11_FINDPYTHON "Force new FindPython" ${_pybind11_findpython_default})
set(PYBIND11_FINDPYTHON
${_pybind11_findpython_default}
CACHE STRING "Force new FindPython - NEW, OLD, COMPAT")
# Allow PYTHON_EXECUTABLE if in FINDPYTHON mode and building pybind11's tests
# (makes transition easier while we support both modes).