Merge topic 'simplify-AppendFlags'

5acf0de1fe cmLocalGenerator: Remove AppendFlags 'const char*' overload

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3786
This commit is contained in:
Brad King
2019-09-06 16:35:00 +00:00
committed by Kitware Robot
8 changed files with 15 additions and 32 deletions

View File

@@ -90,7 +90,7 @@ void cmCommonTargetGenerator::AppendFortranFormatFlags(
}
if (var) {
this->LocalCommonGenerator->AppendFlags(
flags, this->Makefile->GetDefinition(var));
flags, this->Makefile->GetSafeDefinition(var));
}
}

View File

@@ -35,10 +35,8 @@ std::string cmLocalCommonGenerator::GetTargetFortranFlags(
std::string flags;
// Enable module output if necessary.
if (const char* modout_flag =
this->Makefile->GetDefinition("CMAKE_Fortran_MODOUT_FLAG")) {
this->AppendFlags(flags, modout_flag);
}
this->AppendFlags(
flags, this->Makefile->GetSafeDefinition("CMAKE_Fortran_MODOUT_FLAG"));
// Add a module output directory flag if necessary.
std::string mod_dir =

View File

@@ -1125,10 +1125,10 @@ void cmLocalGenerator::GetStaticLibraryFlags(std::string& flags,
this->AppendFlags(flags, this->Makefile->GetSafeDefinition(name));
}
}
this->AppendFlags(flags, target->GetProperty("STATIC_LIBRARY_FLAGS"));
this->AppendFlags(flags, target->GetSafeProperty("STATIC_LIBRARY_FLAGS"));
if (!config.empty()) {
std::string name = "STATIC_LIBRARY_FLAGS_" + config;
this->AppendFlags(flags, target->GetProperty(name));
this->AppendFlags(flags, target->GetSafeProperty(name));
}
std::vector<std::string> options;
@@ -1744,7 +1744,7 @@ void cmLocalGenerator::AddSharedFlags(std::string& flags,
// Add flags for dealing with shared libraries for this language.
if (shared) {
this->AppendFlags(flags,
this->Makefile->GetDefinition(
this->Makefile->GetSafeDefinition(
cmStrCat("CMAKE_SHARED_LIBRARY_", lang, "_FLAGS")));
}
}
@@ -2090,12 +2090,12 @@ void cmLocalGenerator::AddConfigVariableFlags(std::string& flags,
{
// Add the flags from the variable itself.
std::string flagsVar = var;
this->AppendFlags(flags, this->Makefile->GetDefinition(flagsVar));
this->AppendFlags(flags, this->Makefile->GetSafeDefinition(flagsVar));
// Add the flags from the build-type specific variable.
if (!config.empty()) {
flagsVar += "_";
flagsVar += cmSystemTools::UpperCase(config);
this->AppendFlags(flags, this->Makefile->GetDefinition(flagsVar));
this->AppendFlags(flags, this->Makefile->GetSafeDefinition(flagsVar));
}
}
@@ -2110,14 +2110,6 @@ void cmLocalGenerator::AppendFlags(std::string& flags,
}
}
void cmLocalGenerator::AppendFlags(std::string& flags,
const char* newFlags) const
{
if (newFlags && *newFlags) {
this->AppendFlags(flags, std::string(newFlags));
}
}
void cmLocalGenerator::AppendFlagEscape(std::string& flags,
const std::string& rawFlag) const
{

View File

@@ -121,7 +121,6 @@ public:
//! Append flags to a string.
virtual void AppendFlags(std::string& flags,
const std::string& newFlags) const;
virtual void AppendFlags(std::string& flags, const char* newFlags) const;
virtual void AppendFlagEscape(std::string& flags,
const std::string& rawFlag) const;
void AddPchDependencies(cmGeneratorTarget* target,

View File

@@ -831,12 +831,6 @@ void cmLocalUnixMakefileGenerator3::AppendFlags(
this->cmLocalGenerator::AppendFlags(flags, newFlags);
}
void cmLocalUnixMakefileGenerator3::AppendFlags(std::string& flags,
const char* newFlags) const
{
this->cmLocalGenerator::AppendFlags(flags, newFlags);
}
void cmLocalUnixMakefileGenerator3::AppendRuleDepend(
std::vector<std::string>& depends, const char* ruleFileName)
{

View File

@@ -90,7 +90,6 @@ public:
// append flags to a string
void AppendFlags(std::string& flags,
const std::string& newFlags) const override;
void AppendFlags(std::string& flags, const char* newFlags) const override;
// append an echo command
enum EchoColor

View File

@@ -135,7 +135,7 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule(
std::string export_flag_var =
cmStrCat("CMAKE_EXE_EXPORTS_", linkLanguage, "_FLAG");
this->LocalGenerator->AppendFlags(
linkFlags, this->Makefile->GetDefinition(export_flag_var));
linkFlags, this->Makefile->GetSafeDefinition(export_flag_var));
}
this->LocalGenerator->AppendFlags(linkFlags,
@@ -387,10 +387,11 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
if (this->GeneratorTarget->GetPropertyAsBool("WIN32_EXECUTABLE")) {
this->LocalGenerator->AppendFlags(
linkFlags, this->Makefile->GetDefinition("CMAKE_CREATE_WIN32_EXE"));
linkFlags, this->Makefile->GetSafeDefinition("CMAKE_CREATE_WIN32_EXE"));
} else {
this->LocalGenerator->AppendFlags(
linkFlags, this->Makefile->GetDefinition("CMAKE_CREATE_CONSOLE_EXE"));
linkFlags,
this->Makefile->GetSafeDefinition("CMAKE_CREATE_CONSOLE_EXE"));
}
// Add symbol export flags if necessary.
@@ -398,7 +399,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
std::string export_flag_var =
cmStrCat("CMAKE_EXE_EXPORTS_", linkLanguage, "_FLAG");
this->LocalGenerator->AppendFlags(
linkFlags, this->Makefile->GetDefinition(export_flag_var));
linkFlags, this->Makefile->GetSafeDefinition(export_flag_var));
}
this->LocalGenerator->AppendFlags(linkFlags,

View File

@@ -89,12 +89,12 @@ void cmMakefileTargetGenerator::GetTargetLinkFlags(
std::string& flags, const std::string& linkLanguage)
{
this->LocalGenerator->AppendFlags(
flags, this->GeneratorTarget->GetProperty("LINK_FLAGS"));
flags, this->GeneratorTarget->GetSafeProperty("LINK_FLAGS"));
std::string linkFlagsConfig =
cmStrCat("LINK_FLAGS_", cmSystemTools::UpperCase(this->ConfigName));
this->LocalGenerator->AppendFlags(
flags, this->GeneratorTarget->GetProperty(linkFlagsConfig));
flags, this->GeneratorTarget->GetSafeProperty(linkFlagsConfig));
std::vector<std::string> opts;
this->GeneratorTarget->GetLinkOptions(opts, this->ConfigName, linkLanguage);