<div dir="ltr"><div>Just posted this fix on ninja's github page, but figured I'd share it with a larger audience.</div><div><br></div><div>Every time I run cmake && ninja in a new build directory, ninja will rerun cmake because the entry for build.ninja in .ninja_log is older than the timestamp on CMakeCache.txt, even if the timestamps on the actual file isn't older.</div><div><br></div>The following patch fixes the problem, i.e., there's no need to add build.ninja to the ninja_log:<div><br></div><div><pre style="box-sizing:border-box;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:11.9px;margin-top:0px;background-color:rgb(246,248,250);border-radius:3px;line-height:1.45;overflow:auto;padding:16px;color:rgb(36,41,46);margin-bottom:0px"><code style="box-sizing:border-box;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;background:transparent;border-radius:3px;margin:0px;padding:0px;border:0px;word-break:normal;display:inline;line-height:inherit;overflow:visible">diff --git a/src/ninja.cc b/src/ninja.cc
index a093cd1..810b22d 100644
--- a/src/ninja.cc
+++ b/src/ninja.cc
@@ -249,8 +249,6 @@ bool NinjaMain::RebuildManifest(const char* input_file, string* err) {
     return false;

   Builder builder(&state_, config_, &build_log_, &deps_log_, &disk_interface_);
-  if (!builder.AddTarget(node, err))
-    return false;

   if (builder.AlreadyUpToDate())
     return false;  // Not an error, but we didn't rebuild.</code></pre></div><div><br></div><div>hth...</div><div>don</div></div>