summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalNinjaGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-01-13 15:23:23 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2014-01-13 15:23:23 (GMT)
commit020006f936a0a8639e5ab51f65c0d2fb647563d1 (patch)
tree737abc219e09f9c110572798792453f42ab44f9a /Source/cmGlobalNinjaGenerator.cxx
parent9f6b633f37bebecc989cc8fc026da999148038f9 (diff)
parent6fac24d750a3ed25c0c58c682a326293d02b7369 (diff)
downloadCMake-020006f936a0a8639e5ab51f65c0d2fb647563d1.zip
CMake-020006f936a0a8639e5ab51f65c0d2fb647563d1.tar.gz
CMake-020006f936a0a8639e5ab51f65c0d2fb647563d1.tar.bz2
Merge topic 'ninja_fix_rerun'
6fac24d7 Ninja: Avoid re-running CMake on next build after regeneration
Diffstat (limited to 'Source/cmGlobalNinjaGenerator.cxx')
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx29
1 files changed, 24 insertions, 5 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index ec91b0f..65b01db 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -1107,27 +1107,46 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
/*deptype=*/ "",
/*rspfile=*/ "",
/*rspcontent*/ "",
- /*restat=*/ false,
+ /*restat=*/ true,
/*generator=*/ true);
- cmNinjaDeps implicitDeps;
+ cmNinjaDeps implicitDeps, outputs, temp;
+ outputs.push_back(NINJA_BUILD_FILE);
for (std::vector<cmLocalGenerator *>::const_iterator i =
this->LocalGenerators.begin(); i != this->LocalGenerators.end(); ++i) {
const std::vector<std::string>& lf = (*i)->GetMakefile()->GetListFiles();
implicitDeps.insert(implicitDeps.end(), lf.begin(), lf.end());
const std::vector<std::string>& of = (*i)->GetMakefile()->GetOutputFiles();
- implicitDeps.insert(implicitDeps.end(), of.begin(), of.end());
+ temp.insert(temp.end(), of.begin(), of.end());
}
+
+ //Add the CMakeCache.txt file to the implicit depends so that we catch
+ //when somebody manually modifies the file.
+ implicitDeps.push_back("CMakeCache.txt");
+
+ //make sure nothing is in implicit depends twice
std::sort(implicitDeps.begin(), implicitDeps.end());
implicitDeps.erase(std::unique(implicitDeps.begin(), implicitDeps.end()),
implicitDeps.end());
- implicitDeps.push_back("CMakeCache.txt");
+
+
+ //make sure nothing is in outputs depends twice
+ std::sort(temp.begin(), temp.end());
+ temp.erase(std::unique(temp.begin(), temp.end()),
+ temp.end());
+
+ //make sure that anything that is in implicitDeps is also NOT in outputs
+ std::set_difference(temp.begin(),
+ temp.end(),
+ implicitDeps.begin(),
+ implicitDeps.end(),
+ std::back_inserter(outputs));
this->WriteBuild(os,
"Re-run CMake if any of its inputs changed.",
"RERUN_CMAKE",
- /*outputs=*/ cmNinjaDeps(1, NINJA_BUILD_FILE),
+ outputs,
/*explicitDeps=*/ cmNinjaDeps(),
implicitDeps,
/*orderOnlyDeps=*/ cmNinjaDeps(),