cmake: Add pybind11 patch

* Add fatal error is wrong python interpreter is picked by pybind11
This commit is contained in:
Corentin Le Molgat
2023-07-24 11:40:12 +02:00
parent 8dbcd49e1b
commit 49aceccc93
2 changed files with 13 additions and 1 deletions

View File

@@ -164,7 +164,7 @@ if(BUILD_PYTHON AND BUILD_pybind11)
pybind11
GIT_REPOSITORY "https://github.com/pybind/pybind11.git"
GIT_TAG "v2.10.3"
#PATCH_COMMAND git apply --ignore-whitespace "${CMAKE_CURRENT_LIST_DIR}/../../patches/pybind11-2.10.3.patch"
PATCH_COMMAND git apply --ignore-whitespace "${CMAKE_CURRENT_LIST_DIR}/../../patches/pybind11.patch"
)
FetchContent_MakeAvailable(pybind11)
list(POP_BACK CMAKE_MESSAGE_INDENT)

12
patches/pybind11.patch Normal file
View File

@@ -0,0 +1,12 @@
diff --git a/tools/pybind11NewTools.cmake b/tools/pybind11NewTools.cmake
index 7d7424a7..c007fb01 100644
--- a/tools/pybind11NewTools.cmake
+++ b/tools/pybind11NewTools.cmake
@@ -23,6 +23,7 @@ else()
endif()
if(NOT Python_FOUND AND NOT Python3_FOUND)
+ message(FATAL_ERROR "Should not pass here")
if(NOT DEFINED Python_FIND_IMPLEMENTATIONS)
set(Python_FIND_IMPLEMENTATIONS CPython PyPy)
endif()