Skip to content

Commit ddb8b67

Browse files
authored
fix(cmake): allow forcing old FindPython (#5042)
1 parent ec73bda commit ddb8b67

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

tools/pybind11Common.cmake

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,16 @@ endif()
173173
# Check to see which Python mode we are in, new, old, or no python
174174
if(PYBIND11_NOPYTHON)
175175
set(_pybind11_nopython ON)
176+
# We won't use new FindPython if PYBIND11_FINDPYTHON is defined and falselike
177+
# Otherwise, we use if FindPythonLibs is missing or if FindPython was already used
176178
elseif(
177-
_pybind11_missing_old_python STREQUAL "NEW"
178-
OR PYBIND11_FINDPYTHON
179-
OR Python_FOUND
180-
OR Python2_FOUND
181-
OR Python3_FOUND)
179+
(NOT DEFINED PYBIND11_FINDPYTHON OR PYBIND11_FINDPYTHON)
180+
AND (_pybind11_missing_old_python STREQUAL "NEW"
181+
OR PYBIND11_FINDPYTHON
182+
OR Python_FOUND
183+
OR Python3_FOUND
184+
))
185+
182186
# New mode
183187
include("${CMAKE_CURRENT_LIST_DIR}/pybind11NewTools.cmake")
184188

0 commit comments

Comments
 (0)