[CMake] Recursive custom target

Alan W. Irwin irwin at beluga.phys.uvic.ca
Thu Jul 31 14:56:20 EDT 2008

On 2008-07-31 14:10-0000 Piotr JaroszyÅ~Dski wrote:

> Hello,
> is it possible to add a custom target so that it would be visible in
> all the subdirectories?

My experience is that targets are actually available in all directories. The
only caveat is they must have been defined previously in the same
CMakeLists.txt file or in one that has been processed before by cmake.  In
practice, that means you have to use the add_subdirectory commands in the
appropriate order so that needed targets are defined before they are needed.
N.B. Don't use the deprecated subdirs command.  My understanding is it
processes things in a different order than add_subdirectory so will give
some undefined target surprises.

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

Linux-powered Science

More information about the CMake mailing list