cmLocalGenerator: Add GetTargetDefines to get all defines for a target

This commit is contained in:
Tobias Hunger 2016-06-08 13:23:25 +02:00 committed by Brad King
parent 853b1bb4ba
commit f62ed322dc
3 changed files with 20 additions and 11 deletions

View File

@ -246,19 +246,11 @@ std::string cmCommonTargetGenerator::GetDefines(const std::string& l)
ByLanguageMap::iterator i = this->DefinesByLanguage.find(l); ByLanguageMap::iterator i = this->DefinesByLanguage.find(l);
if (i == this->DefinesByLanguage.end()) { if (i == this->DefinesByLanguage.end()) {
std::set<std::string> defines; std::set<std::string> defines;
const char* lang = l.c_str(); this->LocalGenerator->GetTargetDefines(this->GeneratorTarget,
// Add the export symbol definition for shared library objects. this->ConfigName, l, defines);
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, this->LocalGenerator->GetConfigName(),
l);
std::string definesString; std::string definesString;
this->LocalGenerator->JoinDefines(defines, definesString, lang); this->LocalGenerator->JoinDefines(defines, definesString, l);
ByLanguageMap::value_type entry(l, definesString); ByLanguageMap::value_type entry(l, definesString);
i = this->DefinesByLanguage.insert(entry).first; i = this->DefinesByLanguage.insert(entry).first;

View File

@ -1329,6 +1329,20 @@ std::string cmLocalGenerator::GetFrameworkFlags(std::string const& l,
return ::GetFrameworkFlags(l, config, target); return ::GetFrameworkFlags(l, config, target);
} }
void cmLocalGenerator::GetTargetDefines(cmGeneratorTarget const* target,
std::string const& config,
std::string const& lang,
std::set<std::string>& defines) const
{
// Add the export symbol definition for shared library objects.
if (const char* exportMacro = target->GetExportMacro()) {
this->AppendDefines(defines, exportMacro);
}
// Add preprocessor definitions for this target and configuration.
this->AddCompileDefinitions(defines, target, config, lang.c_str());
}
std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib, std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib,
OutputFormat format) OutputFormat format)
{ {

View File

@ -314,6 +314,9 @@ public:
std::string& flags, std::string& linkFlags, std::string& flags, std::string& linkFlags,
std::string& frameworkPath, std::string& linkPath, std::string& frameworkPath, std::string& linkPath,
cmGeneratorTarget* target, bool useWatcomQuote); cmGeneratorTarget* target, bool useWatcomQuote);
void GetTargetDefines(cmGeneratorTarget const* target,
std::string const& config, std::string const& lang,
std::set<std::string>& defines) const;
std::string GetFrameworkFlags(std::string const& l, std::string GetFrameworkFlags(std::string const& l,
std::string const& config, std::string const& config,