Commit 8f076acd authored by Brad King's avatar Brad King

cmLocalGenerator: Remove AddCompileDefinitions method

This method offers the same definitions as `GetTargetDefines` except
that it excludes the "export" macro on shared libraries.  Update call
sites to use `GetTargetDefines` instead.  Some of them were incorrectly
excluding the export macro.
parent f39bc297
Pipeline #120925 failed with stage
......@@ -384,13 +384,8 @@ std::string cmExtraSublimeTextGenerator::ComputeDefines(
cmGeneratorExpressionInterpreter genexInterpreter(lg, config, target,
language);
// Add the export symbol definition for shared library objects.
if (const char* exportMacro = target->GetExportMacro()) {
lg->AppendDefines(defines, exportMacro);
}
// Add preprocessor definitions for this target and configuration.
lg->AddCompileDefinitions(defines, target, config, language);
lg->GetTargetDefines(target, config, language, defines);
const std::string COMPILE_DEFINITIONS("COMPILE_DEFINITIONS");
if (const char* compile_defs = source->GetProperty(COMPILE_DEFINITIONS)) {
lg->AppendDefines(
......
......@@ -267,14 +267,9 @@ std::string cmGhsMultiTargetGenerator::GetDefines(const std::string& language,
if (i == this->DefinesByLanguage.end()) {
std::set<std::string> defines;
const char* lang = language.c_str();
// Add the export symbol definition for shared library objects.
if (const char* exportMacro = this->GeneratorTarget->GetExportMacro()) {
this->LocalGenerator->AppendDefines(defines, exportMacro);
}
// Add preprocessor definitions for this target and configuration.
this->LocalGenerator->AddCompileDefinitions(defines, this->GeneratorTarget,
config, language);
this->LocalGenerator->GetTargetDefines(this->GeneratorTarget, config,
language, defines);
std::string definesString;
this->LocalGenerator->JoinDefines(defines, definesString, lang);
......
......@@ -773,16 +773,6 @@ std::string cmLocalGenerator::GetIncludeFlags(
return flags;
}
void cmLocalGenerator::AddCompileDefinitions(std::set<std::string>& defines,
cmGeneratorTarget const* target,
const std::string& config,
const std::string& lang) const
{
std::vector<std::string> targetDefines;
target->GetCompileDefinitions(targetDefines, config, lang);
this->AppendDefines(defines, targetDefines);
}
void cmLocalGenerator::AddCompileOptions(std::string& flags,
cmGeneratorTarget* target,
const std::string& lang,
......@@ -1237,7 +1227,9 @@ void cmLocalGenerator::GetTargetDefines(cmGeneratorTarget const* target,
}
// Add preprocessor definitions for this target and configuration.
this->AddCompileDefinitions(defines, target, config, lang);
std::vector<std::string> targetDefines;
target->GetCompileDefinitions(targetDefines, config, lang);
this->AppendDefines(defines, targetDefines);
}
std::string cmLocalGenerator::GetTargetFortranFlags(
......
......@@ -251,10 +251,6 @@ public:
bool appendAllImplicitDirs = false) const;
void AddCompileOptions(std::string& flags, cmGeneratorTarget* target,
const std::string& lang, const std::string& config);
void AddCompileDefinitions(std::set<std::string>& defines,
cmGeneratorTarget const* target,
const std::string& config,
const std::string& lang) const;
std::string GetProjectName() const;
......
......@@ -1819,8 +1819,8 @@ void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo(
// Build a list of preprocessor definitions for the target.
std::set<std::string> defines;
this->AddCompileDefinitions(defines, target, this->ConfigName,
implicitLang.first);
this->GetTargetDefines(target, this->ConfigName, implicitLang.first,
defines);
if (!defines.empty()) {
/* clang-format off */
cmakefileStream
......
......@@ -416,7 +416,7 @@ bool cmQtAutoGenInitializer::InitMoc()
auto GetCompileDefinitions =
[this, localGen](std::string const& cfg) -> std::string {
std::set<std::string> defines;
localGen->AddCompileDefinitions(defines, this->Target, cfg, "CXX");
localGen->GetTargetDefines(this->Target, cfg, "CXX", defines);
return cmJoin(defines, ";");
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment