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

Peng Yu pengyu.ut at gmail.com
Tue Aug 14 13:47:06 EDT 2012


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

This depends on how many different things in C++ are used. With some
restrictions, the drawbacks of this approach can be circumvented. To
work with some legacy code which include things that may cause
failure, makepp may not be the appropriate tool. For a project
starting from scratch (so these intruding things can be forbidden),
makepp can be a very good tool as it results in much less makefile to
write compared with cmake.

-- 
Regards,
Peng


More information about the CMake mailing list