Skip to content

[BUG] cmake lead to missng symbols when linking against pybind11::embed while preloading python with find_package(Python3) #2664

Description

@jbigot

Pre-loading python3 in cmake leads to the target not being linked against python library.

find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
find_package(pybind11 2.3.0 REQUIRED)
add_library(my_target [...])
target_link_libraries(my_target pybind11::embed)

I believe this is due to the following line linking against Python3::Python3 in that case instead of Python3::Pythonprovided by the cmake module

if(TARGET ${_Python}::${_Python})

PROPERTY INTERFACE_LINK_LIBRARIES ${_Python}::${_Python})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions