[cmake-developers] Mandatory export of a static library dependency
Lassi Niemistö
lassi.niemisto at wapice.com
Thu Feb 28 02:25:12 EST 2019
Hello,
The cmake "users" list did not wake any replies, so posting here as a possible bug:
I use CMake 3.13RC1. My project produces, installs and exports a shared library target "fooshared". Some logical parts of "fooshared" are reused in an executable, so I have placed those sources into an internal static library target "barstatic". I have used target_link_libraries(fooshared barstatic) to make this work.
Problem: when I try to:
install(TARGETS fooshared DESTINATION <dest> EXPORT myexport)
install(EXPORT myexport DESTINATION <dest>)
..I get a whine about dependency to "barstatic" which is not in the export group "myexport".
I wouldn't like to export "barstatic" at all, it should remain under the hood. I tried to use target_link_libraries(fooshared PRIVATE barstatic) which cut the export chaining, but then symbols from "barstatic" were not available for users of "fooshared" anymore. So I worked around this by converting "barstatic" into an object library, but it feels ugly.
Why would CMake require exporting statically linked dependency targets among the targets that use them? Feels like a bug to me.
Regards,
-Lassi Niemistö
More information about the cmake-developers
mailing list