Skip to content

Commit 4fe905d

Browse files
authored
fix: add flag for overriding classic Python search values (pybind#4195)
* fix: PyPy needs to overrite broken FindPythonInterp values Signed-off-by: Henry Schreiner <[email protected]> * fix: add flag to opt-in to new (cross-compile) behavior Signed-off-by: Henry Schreiner <[email protected]> * Apply suggestions from code review Signed-off-by: Henry Schreiner <[email protected]>
1 parent 8ea75ab commit 4fe905d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tools/FindPythonLibsNew.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,13 @@ if(NOT _PYTHON_SUCCESS MATCHES 0)
151151
return()
152152
endif()
153153

154+
option(
155+
PYBIND11_PYTHONLIBS_OVERWRITE
156+
"Overwrite cached values read from Python library (classic search). Turn off if cross-compiling and manually setting these values."
157+
ON)
154158
# Can manually set values when cross-compiling
155159
macro(_PYBIND11_GET_IF_UNDEF lst index name)
156-
if(NOT DEFINED "${name}")
160+
if(PYBIND11_PYTHONLIBS_OVERWRITE OR NOT DEFINED "${name}")
157161
list(GET "${lst}" "${index}" "${name}")
158162
endif()
159163
endmacro()

0 commit comments

Comments
 (0)