Skip to content

Commit 5c18b65

Browse files
committed
Fix an issue where the pybind::embedd target would link to an incorrect python lib
* with find_package(Python3) it would link the wrong Python3::Pyhton3 instead of the correct Python3::Pyhton * with find_package(Python2) it would link the wrong Python2::Pyhton2 instead of the correct Python3::Pyhton Fix pybind#2664
1 parent 02746cb commit 5c18b65

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/pybind11NewTools.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,11 @@ if(DEFINED ${_Python}_VERSION AND ${_Python}_VERSION VERSION_LESS 3)
144144
endif()
145145

146146
# In CMake 3.18+, you can find these separately, so include an if
147-
if(TARGET ${_Python}::${_Python})
147+
if(TARGET ${_Python}::Python)
148148
set_property(
149149
TARGET pybind11::embed
150150
APPEND
151-
PROPERTY INTERFACE_LINK_LIBRARIES ${_Python}::${_Python})
151+
PROPERTY INTERFACE_LINK_LIBRARIES ${_Python}::Python)
152152
endif()
153153

154154
# CMake 3.15+ has this

0 commit comments

Comments
 (0)