fix: add flag for overriding classic Python search values (#4195)

* fix: PyPy needs to overrite broken FindPythonInterp values

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

* fix: add flag to opt-in to new (cross-compile) behavior

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

* Apply suggestions from code review

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
This commit is contained in:
Henry Schreiner 2022-10-23 00:32:17 -04:00 committed by GitHub
parent 8ea75ab4d7
commit 4fe905d4f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -151,9 +151,13 @@ if(NOT _PYTHON_SUCCESS MATCHES 0)
return()
endif()
option(
PYBIND11_PYTHONLIBS_OVERWRITE
"Overwrite cached values read from Python library (classic search). Turn off if cross-compiling and manually setting these values."
ON)
# Can manually set values when cross-compiling
macro(_PYBIND11_GET_IF_UNDEF lst index name)
if(NOT DEFINED "${name}")
if(PYBIND11_PYTHONLIBS_OVERWRITE OR NOT DEFINED "${name}")
list(GET "${lst}" "${index}" "${name}")
endif()
endmacro()