Skip to content

Exported CMake config should use thirdparty lib targets and preferably find them on its own #64

@jpfeuffer

Description

@jpfeuffer
if(CMAKE_CONFIGURATION_TYPES)
  set_property(TARGET Boost::iostreams APPEND PROPERTY INTERFACE_LINK_LIBRARIES
    "$<$<CONFIG:release>:bz2;lzma;z;zstd>")
else()
  set_property(TARGET Boost::iostreams APPEND PROPERTY INTERFACE_LINK_LIBRARIES
    bz2 lzma z zstd)
endif()

This is not going to work if I just link to Boost::iostreams. How should a consumer know that those libraries are needed?
If I am not mistaken, In modern CMake you would call find_dependencies(ZSTD::ZSTD $Version) and then link to the imported target in your exported CMake file.

This gets especially tricky with boost::regex and ICU, where I don't even know which version I should find in my own CMake script that is "finding" boost.

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