Required prerequisites
What version (or hash if on master) of pybind11 are you using?
3.0.4
Problem description
If find_package(pybind11) is called after a previous find_package(Python) without the development component, then the pybind11::embed target is missing a link to the Python::Python target.
Test case:
cmake_minimum_required(VERSION 3.5)
include(CMakePrintHelpers)
find_package(Python COMPONENTS Interpreter)
find_package(pybind11 REQUIRED)
cmake_print_properties(
TARGETS pybind11::embed
PROPERTIES INTERFACE_LINK_LIBRARIES
)
Output:
Properties for TARGET pybind11::embed:
pybind11::embed.INTERFACE_LINK_LIBRARIES = "pybind11::pybind11"
Note that Python::Python is missing. In https://github.com/pybind/pybind11/blob/v3.0.4/tools/pybind11NewTools.cmake#L96 _Python is set to Python without a check for the Python::Python target (which only exists if the Development component has been requested in the find_package(Python) call), but then this target is needed in https://github.com/pybind/pybind11/blob/v3.0.4/tools/pybind11NewTools.cmake#L227.
The previous find_package(Python) may have been issued by some dependency, so this is not always under the project's control.
Reproducible example code
Is this a regression? Put the last known working version here if it is.
Not a regression
Required prerequisites
What version (or hash if on master) of pybind11 are you using?
3.0.4
Problem description
If
find_package(pybind11)is called after a previousfind_package(Python)without the development component, then thepybind11::embedtarget is missing a link to thePython::Pythontarget.Test case:
Output:
Note that
Python::Pythonis missing. In https://github.com/pybind/pybind11/blob/v3.0.4/tools/pybind11NewTools.cmake#L96_Pythonis set toPythonwithout a check for thePython::Pythontarget (which only exists if the Development component has been requested in thefind_package(Python)call), but then this target is needed in https://github.com/pybind/pybind11/blob/v3.0.4/tools/pybind11NewTools.cmake#L227.The previous
find_package(Python)may have been issued by some dependency, so this is not always under the project's control.Reproducible example code
Is this a regression? Put the last known working version here if it is.
Not a regression