File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -115,6 +115,7 @@ if(PYTHON_IS_DEBUG)
115115 PROPERTY INTERFACE_COMPILE_DEFINITIONS Py_DEBUG)
116116endif ()
117117
118+ # The <3.11 code here does not support release/debug builds at the same time, like on vcpkg
118119if (CMAKE_VERSION VERSION_LESS 3.11)
119120 set_property (
120121 TARGET pybind11::module
@@ -130,16 +131,19 @@ if(CMAKE_VERSION VERSION_LESS 3.11)
130131 APPEND
131132 PROPERTY INTERFACE_LINK_LIBRARIES pybind11::pybind11 $<BUILD_INTERFACE:${PYTHON_LIBRARIES} >)
132133else ()
134+ # The IMPORTED INTERFACE library here is to ensure that "debug" and "release" get processed outside
135+ # of a generator expression - https://gitlab.kitware.com/cmake/cmake/-/issues/18424, as they are
136+ # target_link_library keywords rather than real libraries.
137+ add_library (pybind11::_ClassicPythonLibraries IMPORTED INTERFACE )
138+ target_link_libraries (pybind11::_ClassicPythonLibraries INTERFACE ${PYTHON_LIBRARIES} )
133139 target_link_libraries (
134140 pybind11::module
135141 INTERFACE
136142 pybind11::python_link_helper
137- "$<$<OR:$<PLATFORM_ID:Windows>,$<PLATFORM_ID:Cygwin>>:$<BUILD_INTERFACE:${PYTHON_LIBRARIES} >>"
138- )
143+ "$<$<OR:$<PLATFORM_ID:Windows>,$<PLATFORM_ID:Cygwin>>:pybind11::_ClassicPythonLibraries>" )
139144
140145 target_link_libraries (pybind11::embed INTERFACE pybind11::pybind11
141- $<BUILD_INTERFACE:${PYTHON_LIBRARIES} >)
142-
146+ pybind11::_ClassicPythonLibraries)
143147endif ()
144148
145149function (pybind11_extension name )
You can’t perform that action at this time.
0 commit comments