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

Michael Wild themiwi at gmail.com
Tue Aug 14 07:28:26 EDT 2012


On 08/14/2012 01:18 PM, Peng Yu wrote:
>> 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.

Again, using ccache solves this much more elegantly. And calling md5sum
twice is also not very nice...

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

Well, if you have the time, I'm pretty sure that the CMake developers
would happily review your patch implementing this feature.

> 
> 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.

Yes, but scons is monolithic. It doesn't have the backend build-system
from the front end and hence doesn't have to ensure that GNU Make
behaves consistently with what Xcode, Visual Studio, ninja etc. do.

Michael


More information about the CMake mailing list