Skip to content

Commit

Permalink
Set PYTHON_IS_DEBUG for CMAKE_BUILD_TYPE Debug
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
patrikhuber committed Dec 14, 2024
1 parent f1360a2 commit dcdbc35
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dcdbc35

Please sign in to comment.