[CMake] Preserving library order in target_link_libraries(...) command

Bartlett, Roscoe A rabartl at sandia.gov
Wed Nov 26 16:33:58 EST 2008


Does CMake guarantee that the order of the libraries passed into target_link_libraries(...) is preserved on the actual link line?

For example, If I have:

    target_link_libraries(sometarget lib1 lib2 lib3 ...)

does CMake guarantee that the link line will have the ordering:

    g++  ... -llib1 -llib2 -llib3 ...


This is the behavior that I am seeing in the CMake version that I am using but there is no mention of this in the documentation for target_link_libraries(...) at:


This is important because I have some arbitrary third partly libraries and some of them have some internal dependencies.  I am happy to list these in the right order in one place to take are of the dependency ordering.

I am nervous to rely on the ordering that I am seeing without some assurance that this ordering is guaranteed.


- Ross

Dr. Roscoe A. Bartlett
Senior Member of the Technical Staff
Trilinos Software Engineering Technologies and Integration Lead
Sandia National Laboratories
Phone: (505) 275-6147

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20081126/2dd61e73/attachment.htm>

More information about the CMake mailing list