From 7db864dce9c20e22a3b736f45a88c183ba9586d7 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Tue, 27 Feb 2024 11:08:11 -0500 Subject: [PATCH 1/3] fix(cmake): allow forcing old FindPython Signed-off-by: Henry Schreiner --- tools/pybind11Common.cmake | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/pybind11Common.cmake b/tools/pybind11Common.cmake index 50b15e11b6..78307515c4 100644 --- a/tools/pybind11Common.cmake +++ b/tools/pybind11Common.cmake @@ -174,11 +174,14 @@ endif() if(PYBIND11_NOPYTHON) set(_pybind11_nopython ON) elseif( - _pybind11_missing_old_python STREQUAL "NEW" - OR PYBIND11_FINDPYTHON - OR Python_FOUND - OR Python2_FOUND - OR Python3_FOUND) + NOT (DEFINED PYBIND11_FINDPYTHON AND NOT PYBIND11_FINDPYTHON) + AND (_pybind11_missing_old_python STREQUAL "NEW" + OR PYBIND11_FINDPYTHON + OR Python_FOUND + OR Python2_FOUND + OR Python3_FOUND + )) + # New mode include("${CMAKE_CURRENT_LIST_DIR}/pybind11NewTools.cmake") From be0b3152f92c784defe694a03edcd64134ab4c3f Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Tue, 27 Feb 2024 17:16:26 -0500 Subject: [PATCH 2/3] Update pybind11Common.cmake --- tools/pybind11Common.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/pybind11Common.cmake b/tools/pybind11Common.cmake index 78307515c4..7d48467523 100644 --- a/tools/pybind11Common.cmake +++ b/tools/pybind11Common.cmake @@ -173,12 +173,13 @@ endif() # Check to see which Python mode we are in, new, old, or no python if(PYBIND11_NOPYTHON) set(_pybind11_nopython ON) +# We won't use new FindPython if PYBIND11_FINDPYTHON is defined and falselike +# Otherwise, we use if FindPythonLibs is missing or if FindPython was already used elseif( - NOT (DEFINED PYBIND11_FINDPYTHON AND NOT PYBIND11_FINDPYTHON) + (NOT DEFINED PYBIND11_FINDPYTHON OR PYBIND11_FINDPYTHON) AND (_pybind11_missing_old_python STREQUAL "NEW" OR PYBIND11_FINDPYTHON OR Python_FOUND - OR Python2_FOUND OR Python3_FOUND )) From 864aadb515e426e1af1bc266440b0084828d0cfa Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 27 Feb 2024 22:16:48 +0000 Subject: [PATCH 3/3] style: pre-commit fixes --- tools/pybind11Common.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/pybind11Common.cmake b/tools/pybind11Common.cmake index 7d48467523..57721aeb16 100644 --- a/tools/pybind11Common.cmake +++ b/tools/pybind11Common.cmake @@ -173,8 +173,8 @@ endif() # Check to see which Python mode we are in, new, old, or no python if(PYBIND11_NOPYTHON) set(_pybind11_nopython ON) -# We won't use new FindPython if PYBIND11_FINDPYTHON is defined and falselike -# Otherwise, we use if FindPythonLibs is missing or if FindPython was already used + # We won't use new FindPython if PYBIND11_FINDPYTHON is defined and falselike + # Otherwise, we use if FindPythonLibs is missing or if FindPython was already used elseif( (NOT DEFINED PYBIND11_FINDPYTHON OR PYBIND11_FINDPYTHON) AND (_pybind11_missing_old_python STREQUAL "NEW"