[CMake] handing dependencies in multi-file CMake setup?

Alan W. Irwin irwin at beluga.phys.uvic.ca
Fri Mar 28 12:28:09 EDT 2008


On 2008-03-28 15:27+0100 Ã~Akos Maróy wrote:

> I'm wondering how is it possible to have CMake handle dependencies in a setup 
> where multiple CMakeFiles.txt files are used, and there's a top-level CMake 
> file including them with add_subdirectory()
>
> I tried to use the add_dependencies() statement, but that only 'sees' targets 
> that are defined in that very CMakeFiles.txt file. So it can't be used either 
> in one of the project CMakeFiles, nor in the top-level CMakeFiles.

Actually, ADD_DEPENDENCIES does see targets _that have been defined in prior
cmake processing_. Thus, if you process your directories in the appropriate
order with ADD_SUBDIRECTORY so that targets have already been defined when
you refer to them with ADD_DEPENDENCIES, it should just work.

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