-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
triageNew bug, unverifiedNew bug, unverified
Description
Required prerequisites
- Make sure you've read the documentation. Your issue may be addressed there.
- Search the issue tracker and Discussions to verify that this hasn't already been reported. +1 or comment there if it has.
- Consider asking first in the Gitter chat room or in a Discussion.
What version (or hash if on master) of pybind11 are you using?
2.9.2
Problem description
From discussion #4309:
Looking for pybind11 in CMake CONFIG mode multiple times from separate directories doesn't seem to produce the same targets
From pybind11Common.cmake comments, pybind11 CMake script shall declare regular (ie. non-global) targets. It seems like pybind11NewTools.cmake is using a global include guard though, which explains why the second pybind11::embed targets does not get linked with Python::Python...
Reproducible example code
In FindPython mode, the following snippet:
find_package(
Python
COMPONENTS
Interpreter Development
QUIET)
find_package(
pybind11 CONFIG # ${PYBIND11_VERSION} EXACT
HINTS "${pybind11_ROOT}"
QUIET)
get_target_property(
__linkLibraries pybind11::embed INTERFACE_LINK_LIBRARIES)
message("pybind11::embed::INTERFACE_LINK_LIBRARIES=${__linkLibraries }")
Gives from first execution in the first directory the expected:
pybind11::embed::INTERFACE_LINK_LIBRARIES=pybind11::pybind11;Python::Python
But later gives, from the second execution in another directory, the unexpected (Python::Python missing) :
pybind11::embed::INTERFACE_LINK_LIBRARIES=pybind11::pybind11
Is this a regression? Put the last known working version here if it is.
Not a regression
Metadata
Metadata
Assignees
Labels
triageNew bug, unverifiedNew bug, unverified