From f97ad4b4c1220a0ee282587fc4b62fc745acbc53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Achard?= Date: Fri, 1 May 2026 09:54:50 +0100 Subject: [PATCH] Add /bigobj for pybind11 target on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémi Achard --- share/cmake/modules/Findpybind11.cmake | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/share/cmake/modules/Findpybind11.cmake b/share/cmake/modules/Findpybind11.cmake index bfcb9a696e..89d8cf8ab0 100644 --- a/share/cmake/modules/Findpybind11.cmake +++ b/share/cmake/modules/Findpybind11.cmake @@ -140,5 +140,14 @@ if(_pybind11_TARGET_CREATE) INTERFACE_INCLUDE_DIRECTORIES ${pybind11_INCLUDE_DIR} ) + # /bigobj is needed for bigger binding projects due to the limit to 64k + # addressable sections (see pybind11Common.cmake). + if (MSVC) + set_target_properties(pybind11::module PROPERTIES + INTERFACE_COMPILE_OPTIONS /bigobj + ) + + endif() + mark_as_advanced(pybind11_INCLUDE_DIR pybind11_VERSION) endif()