[CMake] intercomponent link dependencies?

Jed Brown jed at 59A2.org
Wed Jan 13 08:22:53 EST 2010


On Wed, 13 Jan 2010 07:04:46 -0600, Ryan Pavlik <rpavlik at iastate.edu> wrote:
> You could use the CleanLibraryList module I posted a few emails ago: 
> just make a list that contains all the libraries you are going to link 
> your target against, and then just run clean_library_list on it before 
> doing so.

The trouble is that the list of libraries is order-dependent so sorting
them will definitely not work.  Furthermore, list (REMOVE_DUPLICATES
lst) keeps the first copy and drops subsequent ones which means that
some libs will be neglected.  If there are no dependency loops, you can
reverse the list, REMOVE_DUPLICATES, and reverse it again (so that only
the last occurrence of the library shows up).  If there are loops, the
library will need to be explicitly linked more than once, but CMake does
not retain sufficient information to determine when this is safe,
therefore it cannot be provided as a general function (so you can only
"clean" the list when you know that the underlying dependency graph is
acyclic).

Jed


More information about the CMake mailing list