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);
|
||||
if (i == this->DefinesByLanguage.end()) {
|
||||
std::set<std::string> defines;
|
||||
const char* lang = l.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, this->LocalGenerator->GetConfigName(),
|
||||
l);
|
||||
this->LocalGenerator->GetTargetDefines(this->GeneratorTarget,
|
||||
this->ConfigName, l, defines);
|
||||
|
||||
std::string definesString;
|
||||
this->LocalGenerator->JoinDefines(defines, definesString, lang);
|
||||
this->LocalGenerator->JoinDefines(defines, definesString, l);
|
||||
|
||||
ByLanguageMap::value_type entry(l, definesString);
|
||||
i = this->DefinesByLanguage.insert(entry).first;
|
||||
|
|
|
@ -943,7 +943,7 @@ std::string cmLocalGenerator::GetIncludeFlags(
|
|||
void cmLocalGenerator::AddCompileDefinitions(std::set<std::string>& defines,
|
||||
cmGeneratorTarget const* target,
|
||||
const std::string& config,
|
||||
const std::string& lang)
|
||||
const std::string& lang) const
|
||||
{
|
||||
std::vector<std::string> targetDefines;
|
||||
target->GetCompileDefinitions(targetDefines, config, lang);
|
||||
|
@ -1329,6 +1329,20 @@ std::string cmLocalGenerator::GetFrameworkFlags(std::string const& l,
|
|||
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,
|
||||
OutputFormat format)
|
||||
{
|
||||
|
@ -2051,7 +2065,7 @@ void cmLocalGenerator::AppendFlagEscape(std::string& flags,
|
|||
}
|
||||
|
||||
void cmLocalGenerator::AppendDefines(std::set<std::string>& defines,
|
||||
const char* defines_list)
|
||||
const char* defines_list) const
|
||||
{
|
||||
// Short-circuit if there are no definitions.
|
||||
if (!defines_list) {
|
||||
|
@ -2065,7 +2079,8 @@ void cmLocalGenerator::AppendDefines(std::set<std::string>& defines,
|
|||
}
|
||||
|
||||
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();
|
||||
di != defines_vec.end(); ++di) {
|
||||
|
|
|
@ -138,13 +138,15 @@ public:
|
|||
* Encode a list of preprocessor definitions for the compiler
|
||||
* command line.
|
||||
*/
|
||||
void AppendDefines(std::set<std::string>& defines, const char* defines_list);
|
||||
void AppendDefines(std::set<std::string>& defines, std::string defines_list)
|
||||
void AppendDefines(std::set<std::string>& defines,
|
||||
const char* defines_list) const;
|
||||
void AppendDefines(std::set<std::string>& defines,
|
||||
std::string defines_list) const
|
||||
{
|
||||
this->AppendDefines(defines, defines_list.c_str());
|
||||
}
|
||||
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.
|
||||
|
@ -200,7 +202,7 @@ public:
|
|||
void AddCompileDefinitions(std::set<std::string>& defines,
|
||||
cmGeneratorTarget const* target,
|
||||
const std::string& config,
|
||||
const std::string& lang);
|
||||
const std::string& lang) const;
|
||||
|
||||
std::string GetProjectName() const;
|
||||
|
||||
|
@ -312,6 +314,9 @@ public:
|
|||
std::string& flags, std::string& linkFlags,
|
||||
std::string& frameworkPath, std::string& linkPath,
|
||||
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 const& config,
|
||||
|
|
Loading…
Reference in New Issue