[CMake] ADD_SUBDIRECTORY

Alan W. Irwin irwin at beluga.phys.uvic.ca
Thu Dec 20 19:02:46 EST 2007


On 2007-12-20 17:09-0600 George Neill wrote:

> ... or do I just shut up and continue using the dang
> ADD_CUSTOM_TARGET() function :)

Well, don't shut up.  :-)

However, if you have created targets lib1, lib2, lib3 with the
EXCLUDE_FROM_ALL attribute, in various subdirectories and want one special
make target that builds all of them, then use

add_custom_target(libs)
add_dependencies(libs lib1, lib2, lib3)

Since there is no ALL attribute on libs, and you have used the
EXCLUDE_FROM_ALL attribute when building lib1, etc., "make all" will not
build lib1, etc. but "make libs" will.  If there are lots of such libraries
that differ from one configuration to the next, the above procedure can
easily be automated to use a list of libraries that is created by the
configuration.

I haven't been paying that much attention to this thread, but since it's had
a number of posts I assume you have been advised to do the above before.
Usually, you will find the advice on this list is pretty good.  :-)

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 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