[cmake-developers] GCC link options

Brad King brad.king at kitware.com
Tue Jul 24 14:47:02 EDT 2012


On 07/24/2012 12:58 PM, J Decker wrote:
> but after all the libraries that have been applied to this exectuable
> target are a bunch more libraries, presumably the ones that are
> recursively referenced by other libs....

Yes, they are.

> So how can I add a library to the very end of the list to link?

If you specify it as a dependency of all the other libraries then
the dependencies will ensure it ends up at the end.

 target_link_libraries(mylib1 lastlib)
 ...
 target_link_libraries(mylibN lastlib)

Alternatively, don't specify any target_link_libraries calls
so that there are no indirect dependencies.

-Brad



More information about the cmake-developers mailing list