[cmake-developers] why includes the Ninja decency contents sytemheader too?

Brad King brad.king at kitware.com
Tue Feb 6 07:22:48 EST 2018


On 02/06/2018 03:19 AM, Claus Klein wrote:
> IMHO: This make ninja slower without much user benefit!

For reference, the change was made for CMake 3.6 here:

  https://gitlab.kitware.com/cmake/cmake/commit/6d74e7870b8804a5af0bc395a9fbb45c1b3d26a4

The benefit is that sources recompile when system headers change
after an update to system packages.  During discussion of the
change from -MMD to -MD, it was claimed that the performance
impact was minimal:

  https://cmake.org/Bug/view.php?id=14914#c40684

Maybe that's true in some environments but not others.

> On Thu, Nov 30, 2017 at 12:09:55 -0800, Evan Martin wrote:
>> That CMake change is interesting.  While it's true that it is more correct
>> to check the state of the system headers, it's also true that to be fully
>> correct here you need a completely hermetic build.  If CMake doesn't also
>> check the compiler binary as well as any shared libraries that the compiler
>> binary uses, then I think using this extra flag only serves to make ninja
>> slower without much user benefit.

Robustness to some system updates is still valuable even without
being robust to all system updates.

Some people want system headers checked for $reasons, and others
don't want them checked for $other_reasons.  The only way to satisfy
both groups is to make it an option.

The internal `CMAKE_DEPFILE_FLAGS_${lang}` table of flags used for this
would need to be extended with `CMAKE_DEPFILE_NOSYSTEM_FLAGS_${lang}`
alternatives.  Some option would need to be introduced to choose.

-Brad


More information about the cmake-developers mailing list