File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -95,9 +95,24 @@ if(NOT PythonLibsNew_FIND_VERSION)
9595 set (PythonLibsNew_FIND_VERSION "3.6" )
9696endif ()
9797
98+ # Save variables that get set by PythonInterp
99+ macro (_PYBIND11_PUSH_IF_DEFINED name )
100+ if (DEFINED "${name} " )
101+ set ("_PYBIND11_ORIG_${name} " "${${name} }" )
102+ endif ()
103+ endmacro ()
104+
105+ _pybind11_push_if_defined(PYTHON_INCLUDE_DIR)
106+ _pybind11_push_if_defined(PYTHON_MODULE_EXTENSION)
107+ _pybind11_push_if_defined(PYTHON_IS_DEBUG)
108+
98109find_package (PythonInterp ${PythonLibsNew_FIND_VERSION} ${_pythonlibs_required}
99110 ${_pythonlibs_quiet} )
100111
112+ unset (PYTHON_INCLUDE_DIR)
113+ unset (PYTHON_MODULE_EXTENSION)
114+ unset (PYTHON_IS_DEBUG)
115+
101116if (NOT PYTHONINTERP_FOUND)
102117 set (PYTHONLIBS_FOUND FALSE )
103118 set (PythonLibsNew_FOUND FALSE )
@@ -153,7 +168,9 @@ endif()
153168
154169# Can manually set values when cross-compiling
155170macro (_PYBIND11_GET_IF_UNDEF lst index name )
156- if (NOT DEFINED "${name} " )
171+ if (DEFINED "_PYBIND11_ORIG_${name} " )
172+ set ("${name} " "${_PYBIND11_ORIG_${name} }" )
173+ elseif (NOT DEFINED "${name} " )
157174 list (GET "${lst} " "${index} " "${name} " )
158175 endif ()
159176endmacro ()
You can’t perform that action at this time.
0 commit comments