[CMake] Controlling the order of dependencies in a makefile.

Brad King brad.king at kitware.com
Tue May 31 13:38:42 EDT 2005


Shishir Ramam wrote:
> I'd like to know if it is possible to control the order of
> dependencies added to a target in a makefile. 

No make system should ever depend on the order of dependencies in a 
Makefile to function correctly.  The problem is that during parallel 
builds (consider make -j 1000) the order in which the dependencies are 
satisfied can be arbitrary.  You'll have to go with the FOREACH and 
OBJECT_DEPENDS approach for now.  A future CMake version may include a 
makefile generator that evaluates complete targets much like the Visual 
Studio project-file system.  Then this issue will go away because the 
ADD_DEPENDENCIES will be enough.

Alternatively, if the program that generates your header file is 
relatively separate from the rest of your source then you could use a 
TRY_RUN command to build the generator and generate the header all at 
CMake time.

-Brad


More information about the CMake mailing list