From 8fbf39a471593e3607e67a8915a1ec0e150d3298 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 30 Jul 2013 14:39:31 -0400 Subject: [PATCH] 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. --- Source/cmMakefile.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index f3a66bab8..1f5c9110b 100644 --- a/Source/cmMakefile.cxx +++ b/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('/');