mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-16 14:08:35 +08:00
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.
This commit is contained in:
@@ -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));
|
||||
|
@@ -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",
|
||||
|
@@ -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) &&
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user