From dcdbc35112edd9c0958d52f74251411cbfb46575 Mon Sep 17 00:00:00 2001 From: Patrik Huber Date: Sat, 14 Dec 2024 19:20:18 +0000 Subject: [PATCH] Set PYTHON_IS_DEBUG for CMAKE_BUILD_TYPE Debug This fixes the issue that in debug builds, the linker would try and link to pythonxyz_d.lib, but complain that pythonxyz.lib was not found. It looks like setting PYTHON_IS_DEBUG is needed since Python 3.8. The CMake if(...) probably won't work well for multi-configuration generators (like the Visual Studio Generator), but there's not much we can do (generator expressions don't work here). --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d965c901..25a078d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -179,8 +179,12 @@ endif() if(EOS_GENERATE_PYTHON_BINDINGS) set(PYBIND11_PATH "${eos_3RDPARTY_DIR}/pybind11") - # If this fails, the repo has probably not been cloned with submodules. Run: git submodule update --init set(PYBIND11_FINDPYTHON ON) + # Note: I don't think this will work well on Multi-Configuration Generators, but there's nothing we can do: + if(CMAKE_BUILD_TYPE STREQUAL "Debug") + set(PYTHON_IS_DEBUG ON) + endif() + # If this fails, the repo has probably not been cloned with submodules. Run: git submodule update --init add_subdirectory(${PYBIND11_PATH}) # add and initialise pybind11 add_subdirectory(python) # the actual bindings install(DIRECTORY ${eos_3RDPARTY_DIR}/pybind11/include/ DESTINATION 3rdparty/pybind11/include) # pybind11 headers