Mandatory export of a static library dependency

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Mandatory export of a static library dependency

Lassi Niemistö

Hello,

 

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…unless someone can explain why J

 

Regards,

-Lassi Niemistö


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake