[CMake] How to build only when file contents are actually changed?

Peng Yu pengyu.ut at gmail.com
Tue Aug 14 07:18:57 EDT 2012


> CMake really leaves the decision when to recompile something to the
> backend, i.e. GNU Make, Xcode, Visual Studio, ninja etc. It merely
> defines dependencies and then lets the actual build tool handle the
> rest, and most of them choose to use simple time-stamps instead of

Although GNU Make natively does not support build on content change,
it can be hijacked using the trick in the link that I mentioned. I
think that it is not impossible to do so in cmake at the language
level. But it is better if cmake can support this natively.

Yes this is a feature request not a bug report. (To J Decker)

This feature is available to scons. And I think it is reasonable to
expect cmake also have it. I seems that people here did think about it
seriously before, which is a surprise to me.

http://www.scons.org/doc/0.97/HTML/scons-user/c762.html

> hashes. Also note that computing the hash might also incur considerable
> overhead, in particular for very large projects with thousands of files.

It might or might not. The decision should be up to the users. In a
lot of cases, using hash is faster than recompile the objects.

-- 
Regards,
Peng


More information about the CMake mailing list