1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-23 18:08:31 +08:00

COMPILE_WARNING_AS_ERROR: rename methods to prepare link similar functionality

Methods renamed:
* SetIgnoreWasinigAsError => SetIgnoreCompileWasningAsError
* GetIgnoreWasinigAsError => GetIgnoreCompileWasningAsError
This commit is contained in:
Marc Chevrier
2024-11-05 12:35:25 +01:00
parent 3c9b8b4a7c
commit 656267c871
9 changed files with 22 additions and 13 deletions

View File

@@ -3066,7 +3066,7 @@ 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()) {
if (this->GetCMakeInstance()->GetIgnoreCompileWarningAsError()) {
singleLine.push_back("--compile-no-warning-as-error");
}
singleLine.push_back("-S$(CMAKE_SOURCE_DIR)");
@@ -3102,7 +3102,7 @@ void cmGlobalGenerator::AddGlobalTarget_RebuildCache(
cmCustomCommandLine singleLine;
singleLine.push_back(cmSystemTools::GetCMakeCommand());
singleLine.push_back("--regenerate-during-build");
if (this->GetCMakeInstance()->GetIgnoreWarningAsError()) {
if (this->GetCMakeInstance()->GetIgnoreCompileWarningAsError()) {
singleLine.push_back("--compile-no-warning-as-error");
}
singleLine.push_back("-S$(CMAKE_SOURCE_DIR)");

View File

@@ -1956,7 +1956,8 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
cmNinjaRule rule("RERUN_CMAKE");
rule.Command = cmStrCat(
this->CMakeCmd(), " --regenerate-during-build",
cm->GetIgnoreWarningAsError() ? " --compile-no-warning-as-error" : "",
cm->GetIgnoreCompileWarningAsError() ? " --compile-no-warning-as-error"
: "",
" -S",
lg->ConvertToOutputFormat(lg->GetSourceDirectory(),
cmOutputConverter::SHELL),

View File

@@ -325,7 +325,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
cmCustomCommandLines commandLines = cmMakeSingleCommandLine(
{ cmSystemTools::GetCMakeCommand(), argS, argB, "--check-stamp-list",
stampList, "--vs-solution-file", sln });
if (cm->GetIgnoreWarningAsError()) {
if (cm->GetIgnoreCompileWarningAsError()) {
commandLines[0].emplace_back("--compile-no-warning-as-error");
}

View File

@@ -781,7 +781,7 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile(
<< ConvertToMakefilePath(cmSystemTools::GetCMakeCommand())
<< " -S" << ConvertToMakefilePath(root->GetSourceDirectory())
<< " -B" << ConvertToMakefilePath(root->GetBinaryDirectory())
<< (cm->GetIgnoreWarningAsError()
<< (cm->GetIgnoreCompileWarningAsError()
? " --compile-no-warning-as-error"
: "")
<< '\n';

View File

@@ -1100,7 +1100,7 @@ void cmLocalGenerator::AddCompileOptions(std::vector<BT<std::string>>& flags,
}
// Add Warning as errors flags
if (!this->GetCMakeInstance()->GetIgnoreWarningAsError()) {
if (!this->GetCMakeInstance()->GetIgnoreCompileWarningAsError()) {
const cmValue wError = target->GetProperty("COMPILE_WARNING_AS_ERROR");
const cmValue wErrorOpts = this->Makefile->GetDefinition(
cmStrCat("CMAKE_", lang, "_COMPILE_OPTIONS_WARNING_AS_ERROR"));

View File

@@ -829,7 +829,8 @@ void cmLocalUnixMakefileGenerator3::WriteSpecialTargetsBottom(
std::string cmakefileName = "CMakeFiles/Makefile.cmake";
std::string runRule = cmStrCat(
"$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) ",
cm->GetIgnoreWarningAsError() ? "--compile-no-warning-as-error " : "",
cm->GetIgnoreCompileWarningAsError() ? "--compile-no-warning-as-error "
: "",
"--check-build-system ",
this->ConvertToOutputFormat(cmakefileName, cmOutputConverter::SHELL),
" 0");
@@ -1831,7 +1832,8 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
{
std::string runRule = cmStrCat(
"$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) ",
cm->GetIgnoreWarningAsError() ? "--compile-no-warning-as-error " : "",
cm->GetIgnoreCompileWarningAsError() ? "--compile-no-warning-as-error "
: "",
"--check-build-system ",
this->ConvertToOutputFormat(cmakefileName, cmOutputConverter::SHELL),
" 1");

View File

@@ -259,7 +259,7 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
cmMakeSingleCommandLine({ cmSystemTools::GetCMakeCommand(), argS, argB,
"--check-stamp-file", stampName });
if (cm->GetIgnoreWarningAsError()) {
if (cm->GetIgnoreCompileWarningAsError()) {
commandLines[0].emplace_back("--compile-no-warning-as-error");
}
std::string comment = cmStrCat("Building Custom Rule ", makefileIn);

View File

@@ -1241,7 +1241,7 @@ void cmake::SetArgs(const std::vector<std::string>& args)
[](std::string const&, cmake* state) -> bool {
std::cout << "Ignoring COMPILE_WARNING_AS_ERROR target property and "
"CMAKE_COMPILE_WARNING_AS_ERROR variable.\n";
state->SetIgnoreWarningAsError(true);
state->SetIgnoreCompileWarningAsError(true);
return true;
} },
CommandArgument{ "--debugger", CommandArgument::Values::Zero,

View File

@@ -542,8 +542,14 @@ public:
void SetWarnUnusedCli(bool b) { this->WarnUnusedCli = b; }
bool GetCheckSystemVars() const { return this->CheckSystemVars; }
void SetCheckSystemVars(bool b) { this->CheckSystemVars = b; }
bool GetIgnoreWarningAsError() const { return this->IgnoreWarningAsError; }
void SetIgnoreWarningAsError(bool b) { this->IgnoreWarningAsError = b; }
bool GetIgnoreCompileWarningAsError() const
{
return this->IgnoreCompileWarningAsError;
}
void SetIgnoreCompileWarningAsError(bool b)
{
this->IgnoreCompileWarningAsError = b;
}
void MarkCliAsUsed(const std::string& variable);
@@ -753,7 +759,7 @@ private:
bool WarnUninitialized = false;
bool WarnUnusedCli = true;
bool CheckSystemVars = false;
bool IgnoreWarningAsError = false;
bool IgnoreCompileWarningAsError = false;
std::map<std::string, bool> UsedCliVariables;
std::string CMakeEditCommand;
std::string CXXEnvironment;