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

Michael Wild themiwi at gmail.com
Tue Aug 14 10:37:04 EDT 2012


On 08/14/2012 04:32 PM, Peng Yu wrote:
>> You miss the point. If CMake wanted to offer hash-based checking, it
>> would need to do so for *all* backends, not just GNU Make. Good look
>> implementing that hack in Visual Studio or Xcode...
> 
> I get your point that there is not an easy to do content based
> dependency (hash as an approximation) for all backends. For the reason
> mentioned below, I'd think that content based dependency is important.
> The support for this feature should be considered first for GNU make,
> which does seem to be too difficult (as it just requires some
> additional rules). The support for *all* backends can be added later
> on one by one.

I'm not sure how the CMake-devs feel about that, but again, you are most
welcome to submit a patch implementing this.

> 
> o Makepp will not recompile if only comments or whitespace in
>   C/C++ sources have changed.  This is especially important for header
>   files which are automatically generated by other programs and are
>   included in many modules.  Even if the date has changed because the
>   file was remade, makepp won't recompile if the file hasn't changed.
> 

That's plenty dangerous! Only a full C/C++ compiler can decide whether
something is a comment or not (as this requires full parsing
capabilities) and further it might interfere with compiler bugs; I
remember having the problem that with -O3 and old version of the Apple
GCC produced code that segfaulted depending on whether a certain comment
line was present or not!

Michael


More information about the CMake mailing list