summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-01-27 20:25:49 (GMT)
committerBrad King <brad.king@kitware.com>2020-01-27 20:39:04 (GMT)
commit657820a00b83cb28e018a94af2a8bf7475827c8b (patch)
tree4c8d9387d89647d99b4044de08c686b185401636
parentb12b01302878853595ddbc66af5cd21436e8c737 (diff)
downloadCMake-657820a00b83cb28e018a94af2a8bf7475827c8b.zip
CMake-657820a00b83cb28e018a94af2a8bf7475827c8b.tar.gz
CMake-657820a00b83cb28e018a94af2a8bf7475827c8b.tar.bz2
Ninja: Track when running to re-generate during a build
Tell CMake explicitly when it is re-running inside a `ninja` invocation to re-generate the build system.
-rw-r--r--Source/cmGlobalGenerator.cxx1
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx2
-rw-r--r--Source/cmake.cxx2
-rw-r--r--Source/cmake.h3
4 files changed, 7 insertions, 1 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 38ff3ae..5c6bc5c 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -2525,6 +2525,7 @@ void cmGlobalGenerator::AddGlobalTarget_RebuildCache(
gti.PerConfig = false;
cmCustomCommandLine singleLine;
singleLine.push_back(cmSystemTools::GetCMakeCommand());
+ singleLine.push_back("--regenerate-during-build");
singleLine.push_back("-S$(CMAKE_SOURCE_DIR)");
singleLine.push_back("-B$(CMAKE_BINARY_DIR)");
gti.CommandLines.push_back(std::move(singleLine));
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index a9f3711..f92ffd3 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -1530,7 +1530,7 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
{
cmNinjaRule rule("RERUN_CMAKE");
rule.Command =
- cmStrCat(CMakeCmd(), " -S",
+ cmStrCat(CMakeCmd(), " --regenerate-during-build -S",
lg->ConvertToOutputFormat(lg->GetSourceDirectory(),
cmOutputConverter::SHELL),
" -B",
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index ab76df9..d125d0d 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -663,6 +663,8 @@ void cmake::SetArgs(const std::vector<std::string>& args)
} else if ((i < args.size() - 1) &&
(arg.find("--check-stamp-list", 0) == 0)) {
this->CheckStampList = args[++i];
+ } else if (arg == "--regenerate-during-build") {
+ this->RegenerateDuringBuild = true;
}
#if defined(CMAKE_HAVE_VS_GENERATORS)
else if ((i < args.size() - 1) &&
diff --git a/Source/cmake.h b/Source/cmake.h
index 22d3c39..4195e8e 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -547,6 +547,8 @@ public:
}
cmStateSnapshot GetCurrentSnapshot() const { return this->CurrentSnapshot; }
+ bool GetRegenerateDuringBuild() const { return this->RegenerateDuringBuild; }
+
protected:
void RunCheckForUnusedVariables();
int HandleDeleteCacheVariables(const std::string& var);
@@ -621,6 +623,7 @@ private:
FileExtensions FortranFileExtensions;
bool ClearBuildSystem = false;
bool DebugTryCompile = false;
+ bool RegenerateDuringBuild = false;
std::unique_ptr<cmFileTimeCache> FileTimeCache;
std::string GraphVizFile;
InstalledFilesMap InstalledFiles;