Skip to content

Cannot find target Boost::boost after add_subdirectory #41

Closed
@q-ycong-p

Description

@q-ycong-p

My project git checks out Boost's source code to a subdirectory, and adds it through add_subdirectory. I'd like to use Boost::boost in my main project via target_link_libraries(myTarget INTERFACE Boost::boost). However Boost::boost is not recognized while the other individual boost libraries work fine.

I looked into config/BoostConfig.cmake and found that Boost::boost is added as a target here - however BoostConfig.cmake is NOT installed if BOOST_SKIP_INSTALL_RULES or BOOST_SKIP_INSTALL_RULES - in this case is true because I am not installing Boost as project root, but rather added as a subdirectory.

It seems that making Boost::boost available in the add_subdirectory use case would be a correct solution. Can someone (1) help me understand what's the correct way I can workaround it? And (2) Would be make sense to open this as a feature request, or do I miss the intended usage here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions