瀏覽代碼

cmMakefile: Do not track configured files known to be temporary

Since commit ad502502 (cmMakefile: Track configured files so we can
regenerate them, 2013-06-18) cmMakefile::ConfigureFile records the
configured file as an output file generated by CMake.  The intention is
that for make and ninja we can re-run CMake when one of the files it
generates goes missing.  However, files configured temporarily in
CMakeTmp directories by Check* modules do not live past the CMake
invocation.

Teach cmMakefile::ConfigureFile to skip tracking files with "CMakeTmp"
in their path, just like cmCoreTryCompile::TryCompileCode does to
avoid adding dependencies on temporary source files.  In the future
we will need a more general filter to avoid recording as CMake
outputs any files that do not exist at the end of generation.
Brad King 12 年之前
父節點
當前提交
8fbf39a471
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      Source/cmMakefile.cxx

+ 5 - 1
Source/cmMakefile.cxx

@@ -3371,7 +3371,11 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
   std::string sinfile = infile;
   this->AddCMakeDependFile(sinfile);
   cmSystemTools::ConvertToUnixSlashes(soutfile);
-  this->AddCMakeOutputFile(soutfile);
+  // Re-generate if non-temporary outputs are missing.
+  if(soutfile.find("CMakeTmp") == soutfile.npos)
+    {
+    this->AddCMakeOutputFile(soutfile);
+    }
   mode_t perm = 0;
   cmSystemTools::GetPermissions(sinfile.c_str(), perm);
   std::string::size_type pos = soutfile.rfind('/');