Hi,

The inference logic in cmComputeLinkDepends.cxx is both inefficient and
superfluous for our specific use case.  I am proposing a global setting that
would disable the link computation entirely for those that wish to take full
responsibility of the ordering of dependencies.

We are currently using the FindPkgConfig module for generating link lines.
Following the pkg-config guidance, dependencies on system libraries are noted
in the "Libs" section of the pkg-config file as opposed to the "Requires"
section.  This means that common system libraries such as rt are repeated on
the link line.  Unfortunately, this appears to be causing the inference in
cmComputeLinkDepends.cxx to construct highly connected graphs resulting in
delays of several minutes.

For example, consider package X that depends on Y, where both depend on rt.
Since rt is a system library, pkg-config generates -lX -lrt -lY -lrt.  Now
there appears to be a cyclic dependency between rt and Y that the link logic
will attempt to grapple with.  The same problem can also occur even when
pkg-config files only contain a single unique library.  This is because the
output is not well ordered, so two targets might have the order of independent
libraries reversed, and I believe the inference is done globally, so a cycle
inference is possible.  As the number of dependent libraries increases, the
number of edges in the inferred graph explodes.

We have attempted to optimize the algorithm by removing redundant edges, but
this has only had marginal effects.  Assuming that we wish to take
responsibility for avoiding cycles, I would like a mechanism to disable the
inference logic.  One approach would be to extend the semantics of
LINK_INTERFACE_MULTIPLICITY such that setting it to 1 would disable inference
and leave link lines untouched.  However, since this is largely a property of
the library set as opposed to a single target, I would prefer a way to disable
inference at a global level, such as in a custom toolchain file.

Matthew
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to