[CMake] How to implement hard and soft dependencies for ExternalProject targets
Alan W. Irwin
irwin at beluga.phys.uvic.ca
Wed Jul 31 17:13:45 EDT 2013
I have the following dependency issue I am trying to solve with CMake
where certain custom targets have to be run in a particular order:
Here are the details of the use case.
PLplot has both hard (absolutely required by the PLplot build) and soft (not required but
adds capability to the PLplot build if built before PLplot) library dependencies.
The build_projects project allows users to build both kinds of
PLplot dependencies as well as PLplot itself.
What is the most economical way to configure a build_plplot_soft
target that guarantees the soft dependencies are built before PLplot
is built?
I already have the build_plplot_hard target implemented using
ExternalProject_Add. One obvious answer to my question is to
duplicate that call to ExternalProject_Add again with a different
name (build_plplot_soft) and a more extensive DEPENDS list. But that
creates a completely separate build which I don't want since it
duplicates the build effort for PLplot.
My idea is if the user specifies the build_plplot_hard target, they
will take advantage of any soft dependencies that happen to be already
built, but if they are starting fresh, the soft dependencies won't be
built as a dependency of that target (to save build time at the
expense of PLplot capability). And if the user specifies
the build_plplot_soft target, then there is a guarantee the
soft dependencies are built before plplot is built.
I am thinking along the lines of
add_custom_target(build_plplot_soft)
add_dependencies(build_plplot_soft ${soft_depend_targets_list} build_plplot_hard)
But I am virtually positive that add_dependencies in a parallel build
situation doesn't guarantee that the ${soft_depend_targets_list} list of
dependencies is built before the build_plplot_hard target dependency).
Any ideas for imposing a certain order for how target dependencies are
built in a parallel build situation?
Alan
__________________________
Alan W. Irwin
Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).
Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________
Linux-powered Science
__________________________
More information about the CMake
mailing list