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

2008-11-26 Thread Bartlett, Roscoe A
Hello,

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:


http://www.cmake.org/cmake/help/cmake2.6docs.html#command:target_link_libraries

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.

Thanks,

- 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



___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

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

2008-11-26 Thread Brad King

Bartlett, Roscoe A wrote:
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 ...

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


It is preserved for exactly your reason (unknown third-party 
inter-dependencies).  CMake might add libraries to the end of the list 
to satisfy known dependencies but always starts with the exact order 
(and multiplicity) provided by the user.


-Brad
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake