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

Amitha Perera perera at cs.rpi.edu
Fri Jul 27 15:08:02 EDT 2001


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.

Amitha.

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