From 0a38ffb61fa0b8fdb99b3ae8afe5bcf8661fc308 Mon Sep 17 00:00:00 2001 From: debloip Date: Thu, 18 Jan 2024 13:36:42 -0500 Subject: [PATCH] HYDRA-700 : Keep BOOST_PYTHON_DEBUG in MSVC builds (+explanation) --- cmake/compiler_config.cmake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmake/compiler_config.cmake b/cmake/compiler_config.cmake index db021f6df1..a383e7c00b 100644 --- a/cmake/compiler_config.cmake +++ b/cmake/compiler_config.cmake @@ -128,6 +128,13 @@ function(mayaHydra_compile_config TARGET) target_compile_definitions(${TARGET} PRIVATE ${MSVC_DEFINITIONS} + # In debug builds, Boost's wrap_python.hpp will #undef _DEBUG when BOOST_DEBUG_PYTHON is not defined, + # and will then include pyconfig.h : + # https://github.com/boostorg/python/blob/boost-1.81.0/include/boost/python/detail/wrap_python.hpp#L23-L57 + # pyconfig.h will then autolink the Python lib; however, since _DEBUG was #undef'd, it will try to + # link against the release version of the Python lib, causing a linker error : + # https://github.com/python/cpython/blob/v3.11.4/PC/pyconfig.h#L269-L286 + $<$:BOOST_DEBUG_PYTHON> ) endif()