[CMake] dependencies between external projects (not DEPENDS)

Neil Carlson neil.n.carlson at gmail.com
Mon Aug 15 11:56:03 EDT 2016


I'm struggling with how to handle dependencies between external projects in
a
superbuild.  The issue is different than simply ensuring that one gets
built before
another using the DEPENDS keyword -- that's trivial.

Suppose I have two external libraries A and B, where B depends on A.  It is
not
always possible to correctly define variables like A_LIBRARIES that feed
into the
externalproject_add for B that anticipate what will come out of the A
configure/build.
There are sometimes additional link libraries that only come to light after
A is
actually configured.

How do people handle these situations?  I'm thinking of a multi-pass
approach
where one runs cmake/make twice.  The first installs A skipping the
dependent B.
The second builds B (skipping a found A) using correctly set variables from
a
FindA module.

Incidentally, is it kosher to have a Find module invoke a find_package?
There are
examples in of this in standard Find modules.  This creates problems in the
superbuild context, where say A is found, but rejected by the superbuild
because
of missing features, for example, but FindB finds A and uses it.

Thanks for your advice.

-Neil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160815/d8e7714b/attachment.html>


More information about the CMake mailing list