[CMake] Re-executing the make command with few or no source tree changes is extremely efficient for CMake-2.4.3

Alan W. Irwin irwin at beluga.phys.uvic.ca
Thu Aug 17 16:13:15 EDT 2006


On 2006-08-17 15:00-0400 Brad King wrote:

> # In one directory:
> ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/my_header.h ...)
> ADD_CUSTOM_TARGET(make_sure_my_header_is_up_to_date
>  DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/my_header.h)
>
> # In another directory:
> ADD_EXECUTABLE(exe_needing_my_header ...)
> ADD_DEPENDENCY(exe_needing_my_header make_sure_my_header_is_up_to_date)

Thanks very much for that hint, Brad.  (Note to others reading this, those
${CMAKE_CURRENT_BINARY_DIR} prefixes are essential, otherwise you still get
regeneration).  Perhaps this hint belongs in the Wiki?

Now there is no longer any gcc or g77 activity in my make output on the
second make try with no changes: Here are the time results on a 2.4GHz box
for a second make with no source changes on a rather complicated project:

software at chickadee> time make >& make.out1

real    0m1.070s
user    0m0.625s
sys     0m0.426s

_Much_ better than previous results.  I have changed the subject line
accordingly.

Thanks, again, Brad.

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