Merge topic 'refactor-cmLocalGenerator-flags'
f62ed322
cmLocalGenerator: Add GetTargetDefines to get all defines for a target853b1bb4
cmLocalGenerator: Constify AppendDefines and AddCompileDefinitions
This commit is contained in:
commit
7ce354d3ac
|
@ -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;
|
||||||
|
|
|
@ -943,7 +943,7 @@ std::string cmLocalGenerator::GetIncludeFlags(
|
||||||
void cmLocalGenerator::AddCompileDefinitions(std::set<std::string>& defines,
|
void cmLocalGenerator::AddCompileDefinitions(std::set<std::string>& defines,
|
||||||
cmGeneratorTarget const* target,
|
cmGeneratorTarget const* target,
|
||||||
const std::string& config,
|
const std::string& config,
|
||||||
const std::string& lang)
|
const std::string& lang) const
|
||||||
{
|
{
|
||||||
std::vector<std::string> targetDefines;
|
std::vector<std::string> targetDefines;
|
||||||
target->GetCompileDefinitions(targetDefines, config, lang);
|
target->GetCompileDefinitions(targetDefines, config, lang);
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
|
@ -2051,7 +2065,7 @@ void cmLocalGenerator::AppendFlagEscape(std::string& flags,
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmLocalGenerator::AppendDefines(std::set<std::string>& defines,
|
void cmLocalGenerator::AppendDefines(std::set<std::string>& defines,
|
||||||
const char* defines_list)
|
const char* defines_list) const
|
||||||
{
|
{
|
||||||
// Short-circuit if there are no definitions.
|
// Short-circuit if there are no definitions.
|
||||||
if (!defines_list) {
|
if (!defines_list) {
|
||||||
|
@ -2065,7 +2079,8 @@ void cmLocalGenerator::AppendDefines(std::set<std::string>& defines,
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmLocalGenerator::AppendDefines(
|
void cmLocalGenerator::AppendDefines(
|
||||||
std::set<std::string>& defines, const std::vector<std::string>& defines_vec)
|
std::set<std::string>& defines,
|
||||||
|
const std::vector<std::string>& defines_vec) const
|
||||||
{
|
{
|
||||||
for (std::vector<std::string>::const_iterator di = defines_vec.begin();
|
for (std::vector<std::string>::const_iterator di = defines_vec.begin();
|
||||||
di != defines_vec.end(); ++di) {
|
di != defines_vec.end(); ++di) {
|
||||||
|
|
|
@ -138,13 +138,15 @@ public:
|
||||||
* Encode a list of preprocessor definitions for the compiler
|
* Encode a list of preprocessor definitions for the compiler
|
||||||
* command line.
|
* command line.
|
||||||
*/
|
*/
|
||||||
void AppendDefines(std::set<std::string>& defines, const char* defines_list);
|
void AppendDefines(std::set<std::string>& defines,
|
||||||
void AppendDefines(std::set<std::string>& defines, std::string defines_list)
|
const char* defines_list) const;
|
||||||
|
void AppendDefines(std::set<std::string>& defines,
|
||||||
|
std::string defines_list) const
|
||||||
{
|
{
|
||||||
this->AppendDefines(defines, defines_list.c_str());
|
this->AppendDefines(defines, defines_list.c_str());
|
||||||
}
|
}
|
||||||
void AppendDefines(std::set<std::string>& defines,
|
void AppendDefines(std::set<std::string>& defines,
|
||||||
const std::vector<std::string>& defines_vec);
|
const std::vector<std::string>& defines_vec) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Join a set of defines into a definesString with a space separator.
|
* Join a set of defines into a definesString with a space separator.
|
||||||
|
@ -200,7 +202,7 @@ public:
|
||||||
void AddCompileDefinitions(std::set<std::string>& defines,
|
void AddCompileDefinitions(std::set<std::string>& defines,
|
||||||
cmGeneratorTarget const* target,
|
cmGeneratorTarget const* target,
|
||||||
const std::string& config,
|
const std::string& config,
|
||||||
const std::string& lang);
|
const std::string& lang) const;
|
||||||
|
|
||||||
std::string GetProjectName() const;
|
std::string GetProjectName() const;
|
||||||
|
|
||||||
|
@ -312,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,
|
||||||
|
|
Loading…
Reference in New Issue