From 5c18b655aff4f7ecdf1e7f6b53eb4edbce6ed8cf Mon Sep 17 00:00:00 2001 From: Julien Bigot Date: Sun, 15 Nov 2020 16:27:05 +0100 Subject: [PATCH] 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 #2664 --- tools/pybind11NewTools.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/pybind11NewTools.cmake b/tools/pybind11NewTools.cmake index 357cc61c13..dd1b972c0f 100644 --- a/tools/pybind11NewTools.cmake +++ b/tools/pybind11NewTools.cmake @@ -144,11 +144,11 @@ if(DEFINED ${_Python}_VERSION AND ${_Python}_VERSION VERSION_LESS 3) endif() # In CMake 3.18+, you can find these separately, so include an if -if(TARGET ${_Python}::${_Python}) +if(TARGET ${_Python}::Python) set_property( TARGET pybind11::embed APPEND - PROPERTY INTERFACE_LINK_LIBRARIES ${_Python}::${_Python}) + PROPERTY INTERFACE_LINK_LIBRARIES ${_Python}::Python) endif() # CMake 3.15+ has this