summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-05-30 21:23:42 (GMT)
committerBrad King <brad.king@kitware.com>2023-05-30 21:44:43 (GMT)
commitda27ff1e963b11dd91060fddb9e47a3135b4ac6c (patch)
treee82cf3edfcf507fbd0cb2a97a3bfdce6b7b0a60a /Source/cmGlobalGenerator.cxx
parente0b48284a1beaef7f5a49073c8d4684418476ae1 (diff)
downloadCMake-da27ff1e963b11dd91060fddb9e47a3135b4ac6c.zip
CMake-da27ff1e963b11dd91060fddb9e47a3135b4ac6c.tar.gz
CMake-da27ff1e963b11dd91060fddb9e47a3135b4ac6c.tar.bz2
Preserve --compile-no-warning-as-error in automatic CMake re-runs
When the build system re-runs `cmake` to regenerate itself, preserve the `--compile-no-warning-as-error` option if it was used when `cmake` was last explicitly invoked. Normally such settings are preserved in the cache, but the purpose of this option is to be beyond the reach of project code.
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r--Source/cmGlobalGenerator.cxx6
1 files changed, 6 insertions, 0 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 22d5aeb..815629b 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -2821,6 +2821,9 @@ void cmGlobalGenerator::AddGlobalTarget_EditCache(
std::string edit_cmd = this->GetEditCacheCommand();
if (!edit_cmd.empty()) {
singleLine.push_back(std::move(edit_cmd));
+ if (this->GetCMakeInstance()->GetIgnoreWarningAsError()) {
+ singleLine.push_back("--compile-no-warning-as-error");
+ }
singleLine.push_back("-S$(CMAKE_SOURCE_DIR)");
singleLine.push_back("-B$(CMAKE_BINARY_DIR)");
gti.Message = "Running CMake cache editor...";
@@ -2854,6 +2857,9 @@ void cmGlobalGenerator::AddGlobalTarget_RebuildCache(
cmCustomCommandLine singleLine;
singleLine.push_back(cmSystemTools::GetCMakeCommand());
singleLine.push_back("--regenerate-during-build");
+ if (this->GetCMakeInstance()->GetIgnoreWarningAsError()) {
+ singleLine.push_back("--compile-no-warning-as-error");
+ }
singleLine.push_back("-S$(CMAKE_SOURCE_DIR)");
singleLine.push_back("-B$(CMAKE_BINARY_DIR)");
gti.CommandLines.push_back(std::move(singleLine));