[cmake-developers] install(EXPORT) with PRIVATE dependency: possible bug

Tamás Kenéz tamas.kenez at gmail.com
Thu Jan 14 16:12:49 EST 2016


It seems that the names of the PRIVATE dependencies of a library are not
affected by either the NAMESPACE option or the EXPORT_NAME property. A
minimal example:

    add_library(one STATIC ...)
    add_library(two STATIC ...)
    target_link_libraries(two PRIVATE one)
    install(TARGETS one two EXPORT targets DESTINATION lib)
    install(EXPORT targets NAMESPACE ns:: DESTINATION cmake)

The generated `targets.cmake` describes the dependency relation with:

    set_target_properties(ns::two PROPERTIES
      INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:one>"
    )

That is, it uses `one` instead of `ns::one`. Changing the EXPORT_NAME of
`one` has no effect either.

It works find if I replace PRIVATE with PUBLIC or INTERFACE (of course
there'll be no more LINK_ONLY genexp in that case).

Is this really a bug or did I miss something? I also searched Mantis and
haven't found anything related.

Tamas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20160114/547a775f/attachment.html>


More information about the cmake-developers mailing list