summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-06-01 13:45:49 (GMT)
committerKitware Robot <kwrobot@kitware.com>2023-06-01 13:45:56 (GMT)
commitaa3675d28186124a3175b89ed9bfd426c5d6b530 (patch)
tree2975e1935eb275338e0c475e5ff3ee6bfb1bfba2 /Source
parent859de07aa38af805b74801e0f124e06233263e78 (diff)
parentda27ff1e963b11dd91060fddb9e47a3135b4ac6c (diff)
downloadCMake-aa3675d28186124a3175b89ed9bfd426c5d6b530.zip
CMake-aa3675d28186124a3175b89ed9bfd426c5d6b530.tar.gz
CMake-aa3675d28186124a3175b89ed9bfd426c5d6b530.tar.bz2
Merge topic 'cmake-compile-no-warning-as-error'
da27ff1e96 Preserve --compile-no-warning-as-error in automatic CMake re-runs e0b48284a1 Xcode: Internally uses -S instead of -H to specify source directory Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !8522
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalGenerator.cxx6
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx19
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx3
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx14
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx6
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx4
6 files changed, 34 insertions, 18 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index f50c4cb..07c8f17 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -2845,6 +2845,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...";
@@ -2878,6 +2881,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));
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 8698e77..9380d7d 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -1816,17 +1816,21 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
if (this->GlobalSettingIsOn("CMAKE_SUPPRESS_REGENERATION")) {
return;
}
+
+ cmake* cm = this->GetCMakeInstance();
const auto& lg = this->LocalGenerators[0];
{
cmNinjaRule rule("RERUN_CMAKE");
- rule.Command =
- cmStrCat(this->CMakeCmd(), " --regenerate-during-build -S",
- lg->ConvertToOutputFormat(lg->GetSourceDirectory(),
- cmOutputConverter::SHELL),
- " -B",
- lg->ConvertToOutputFormat(lg->GetBinaryDirectory(),
- cmOutputConverter::SHELL));
+ rule.Command = cmStrCat(
+ this->CMakeCmd(), " --regenerate-during-build",
+ cm->GetIgnoreWarningAsError() ? " --compile-no-warning-as-error" : "",
+ " -S",
+ lg->ConvertToOutputFormat(lg->GetSourceDirectory(),
+ cmOutputConverter::SHELL),
+ " -B",
+ lg->ConvertToOutputFormat(lg->GetBinaryDirectory(),
+ cmOutputConverter::SHELL));
rule.Description = "Re-running CMake...";
rule.Comment = "Rule for re-running cmake.";
rule.Generator = true;
@@ -1850,7 +1854,6 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
reBuild.Variables["pool"] = "console";
}
- cmake* cm = this->GetCMakeInstance();
if (this->SupportsManifestRestat() && cm->DoWriteGlobVerifyTarget()) {
{
cmNinjaRule rule("VERIFY_GLOBS");
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index 819bb09..aefb67a 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -354,6 +354,9 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
cmCustomCommandLines commandLines = cmMakeSingleCommandLine(
{ cmSystemTools::GetCMakeCommand(), argS, argB, "--check-stamp-list",
stampList, "--vs-solution-file", sln });
+ if (cm->GetIgnoreWarningAsError()) {
+ commandLines[0].emplace_back("--compile-no-warning-as-error");
+ }
// Add the rule. Note that we cannot use the CMakeLists.txt
// file as the main dependency because it would get
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 110933e..fd58f75 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -753,14 +753,12 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile(
makefileStream << this->ConvertToRelativeForMake(checkCache)
<< ": $(TARGETS)\n";
- makefileStream << "\t"
- << this->ConvertToRelativeForMake(
- cmSystemTools::GetCMakeCommand())
- << " -H"
- << this->ConvertToRelativeForMake(root->GetSourceDirectory())
- << " -B"
- << this->ConvertToRelativeForMake(root->GetBinaryDirectory())
- << "\n";
+ makefileStream
+ << "\t" << this->ConvertToRelativeForMake(cmSystemTools::GetCMakeCommand())
+ << " -S" << this->ConvertToRelativeForMake(root->GetSourceDirectory())
+ << " -B" << this->ConvertToRelativeForMake(root->GetBinaryDirectory())
+ << (cm->GetIgnoreWarningAsError() ? " --compile-no-warning-as-error" : "")
+ << "\n";
}
static bool objectIdLessThan(const std::unique_ptr<cmXCodeObject>& l,
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index cfe4eb6..43711b3 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -828,7 +828,8 @@ void cmLocalUnixMakefileGenerator3::WriteSpecialTargetsBottom(
}
std::string cmakefileName = "CMakeFiles/Makefile.cmake";
std::string runRule = cmStrCat(
- "$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) "
+ "$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) ",
+ cm->GetIgnoreWarningAsError() ? "--compile-no-warning-as-error " : "",
"--check-build-system ",
this->ConvertToOutputFormat(cmakefileName, cmOutputConverter::SHELL),
" 0");
@@ -1805,7 +1806,8 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
std::string cmakefileName = "CMakeFiles/Makefile.cmake";
{
std::string runRule = cmStrCat(
- "$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) "
+ "$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) ",
+ cm->GetIgnoreWarningAsError() ? "--compile-no-warning-as-error " : "",
"--check-build-system ",
this->ConvertToOutputFormat(cmakefileName, cmOutputConverter::SHELL),
" 1");
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index a7ea0df..af0e118 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -262,6 +262,10 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
cmCustomCommandLines commandLines =
cmMakeSingleCommandLine({ cmSystemTools::GetCMakeCommand(), argS, argB,
"--check-stamp-file", stampName });
+
+ if (cm->GetIgnoreWarningAsError()) {
+ commandLines[0].emplace_back("--compile-no-warning-as-error");
+ }
std::string comment = cmStrCat("Building Custom Rule ", makefileIn);
auto cc = cm::make_unique<cmCustomCommand>();
cc->SetOutputs(stampName);