[CMake] Target properties, dependencies and subdirs order?
Alan W. Irwin
irwin at beluga.phys.uvic.ca
Mon Sep 25 11:15:37 EDT 2006
On 2006-09-25 15:18+0200 Jeroen Janssen wrote:
> Example:
> <topdir>
> TestDll directory with interface/ and src/
> TestExe directory with src/
>
> TestExe has a dependency to TestDll (with add_dependency)
> [...] this only works when <topdir> has TestDll before TestExe in
> the SUBDIRS section. If TestDll is after TestExe (e.g. "SUBDIRS(
> TestExe TestDll)" ), the GET_TARGET_PROPERTY fails on TestDll
> (resulting in NOTFOUND).
We have run into this CMake characteristic also (with the alternative
add_subdirectory command). My mental model (I am still fairly new to CMake
so this conclusion is subject to correction from CMake experts) is CMake is
one-pass (which is part of the reason why it is so fast). The result is
targets must be processed by CMake in dependency order.
In the PLplot project we have a number of different build methods (e.g.,
whether we use plug-ins for our plot devices or put that code in the
principal library) which can change the target dependency order. The result
is we have to process subdirectories in different orders (so that targets
are processed by CMake in dependency order as in the rule I expressed
above). However, it is easy to conform to that rule with the appropriate if
statements controlling the order of add_subdirectory commands.
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); PLplot scientific plotting software
package (plplot.org); the Yorick front-end to PLplot (yplot.sf.net); 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