Suppose I have some library foo
that is exported, and depends on some header-only library target Bar::header-only
privately:
add_library(foo)
target_link_libraries(foo
PRIVATE
Bar::header-only
)
Now, when exporting foo
, its INTERFACE_LINK_LIBRARIES
property will list Bar::header-only
as a transitive link dependency, which I somehow would like to avoid; it is a header-only library no longer required for linking against foo
once exported. How should this case be handled?
I looked at https://cmake.org/cmake/help/latest/prop_tgt/INTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE.html#interface-link-libraries-direct-exclude but Iām not sure whether it is the correct approach to take.