[Cmake] stripping repeated link directories and libraries from each makefile.

Bill Hoffman bill.hoffman at kitware.com
Fri Jul 27 15:03:34 EDT 2001


There is a TARGET_LINK_LIBRARIES that adds a library to the specific target.
However, that does not help your case.

I guess a command could be written, to uniqify the library list.

-Bill


At 02:55 PM 7/27/2001 -0400, Amitha Perera wrote:
>The "problem" is that we are using CMakeListsLink.txt to specify the
>immediate dependencies. This means if an executable depends on vnl and
>vgl, for example, vcl will be linked in twice, since both vnl and vgl
>depend on it.
>
>We can't just wrap the CMakeListsLink.txt in an IF statement, because
>that will only process the first time, after vnl, and then vgl will
>not resolve it's dependencies on vcl.
>
>Is there a better way of specifing immediate dependencies using CMake?
>Perhaps a modified ADD_LIBRARY, something like
>  ADD_LIBRARY( vnl vnl_source_files DEPENDS vcl netlib )
>so that someone could just
>  LINK_LIBRARIES( vnl )
>and automatically get
>  -lvnl -lvcl -lnetlib
>
>This would mean, however, that CMake would need to process a
>dependency graph. Potentially one with cycles. However, this is
>probably a good thing anyway.
>
>On Fri, Jul 27, 2001 at 12:24:45PM -0400, Bill Hoffman wrote:
>> I don't think cmake should uniqify the libraries because there are
>> many existing libraries that are not designed like VXL, and it is
>> quite common to have to repeat libraries.  However, your problem
>> sounds more like mis-formed cmakelist files.  cmake only uses
>> duplicates if they are in the cmakelist files.
>> 
>> -Bill 





More information about the CMake mailing list