[cmake-developers] target_link_libraries and --start-group/--end-group ?
Gregor Jasny
gjasny at googlemail.com
Tue Jan 6 01:19:36 EST 2015
Hello,
On 05/01/15 20:09, Robert Goulet wrote:
> My project needs to link with an external library which actually consist
> of a set of libraries. Adding these libs using target_link_libraries
> should be working just fine but unfortunately these libs have a bunch of
> circular dependencies, so it fails. In the makefile, we link with these
> libs using this syntax:
>
> -Wl,--start-group …libs… -Wl,--end-group
>
> …so that the linker is able to correctly find all symbols. What’s the
> proper way to deal with this using CMake? I tried to add the group flags
> to target_link_libraries but it does not work. Thanks!
I'm not 100% sure that this also works with circular dependencies, but
you could create an IMPORTED target per library and declare its
dependencies via INTERFACE_LINK_LIBRARIES.
Adding the imported ones to your executable should do the right thing.
Thanks,
Gregor
PS: This list is mainly for development of CMake; cmake at cmake.org is for
the actual consumers.
More information about the cmake-developers
mailing list