[CMake] Shortcomings with exporting and importing targets

Benjamin Shadwick benshadwick at gmail.com
Wed Jul 24 18:36:00 EDT 2019


As a followup to my previous email dated 7/15/19, I learned from a
co-worker this week that if Project A's target_link_libraries() links
against an explicit path+filename of an external library, a subsequent
install(TARGETS ...) command will actually include that dependency in the
exported target for Library A1, such that it will be picked up as a
transitive dependency when later linking Library A1 into a binary in
Project B.

This makes me think that install(TARGETS ...) not supporting imported
targets is likely an oversight by the CMake developers. This ought to be
fixed, because it effectively discourages people from following the "modern
CMake" approach of using targets wherever possible.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20190724/8e4aebe8/attachment.html>


More information about the CMake mailing list