Skip to content

Commit

Permalink
fix: add flag for overriding classic Python search values (pybind#4195)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
henryiii committed Oct 24, 2022
1 parent ce63bcb commit 0e82c36
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tools/FindPythonLibsNew.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 0e82c36

Please sign in to comment.