[CMake] target_link_libraries chain dynamic->static

Petr Kmoch petr.kmoch at gmail.com
Thu May 17 10:21:57 EDT 2012


Hi Anton,

you should look into target property LINK_INTERFACE_LIBRARIES (and its
per-configuration variants) which controls "transitive linking."
target_link_libraries() also accepts LINK_INTERFACE_LIBRARIES as an
argument mode, which sets the property instead of linking.

Petr

On Thu, May 17, 2012 at 3:07 PM, Anton Sibilev <anton.sibilev at gmail.com> wrote:
> Hello! I use 2.8.8 and my build chais is following:
>
> I have 3 static libs  - A.a, B.a, C.a.
> I'm creating new D.so (add_library .. SHARED .. ) with limited set on
> functions from static libs (linking -lA -lB -lC to resolve functions).
> Then I'm creating application, wich use D.so as main library. I'm linking it
> with target_link_libraries(target D.so).
>
> But finally, my link cmdline is following: -o application -lD -lA -lB -C.
> But I want to link only one shared lib - D.so!
> As I understand this is results of caching libs. How I can resolve this?
>
> Thanks!
>
>
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list