cmMakefile: Add a PropertyKeys accessor.

This commit is contained in:
Stephen Kelly 2015-07-18 18:59:18 +02:00
parent e7fbd489e0
commit cbe3ee58ca
3 changed files with 22 additions and 7 deletions

View File

@ -814,14 +814,15 @@ void cmGlobalVisualStudio7Generator
{ {
bool extensibilityGlobalsOverridden = false; bool extensibilityGlobalsOverridden = false;
bool extensibilityAddInsOverridden = false; bool extensibilityAddInsOverridden = false;
const cmPropertyMap& props = root->GetMakefile()->GetProperties(); const std::vector<std::string> propKeys =
for(cmPropertyMap::const_iterator itProp = props.begin(); root->GetMakefile()->GetPropertyKeys();
itProp != props.end(); ++itProp) for(std::vector<std::string>::const_iterator it = propKeys.begin();
it != propKeys.end(); ++it)
{ {
if(itProp->first.find("VS_GLOBAL_SECTION_") == 0) if(it->find("VS_GLOBAL_SECTION_") == 0)
{ {
std::string sectionType; std::string sectionType;
std::string name = itProp->first.substr(18); std::string name = it->substr(18);
if(name.find("PRE_") == 0) if(name.find("PRE_") == 0)
{ {
name = name.substr(4); name = name.substr(4);
@ -842,7 +843,8 @@ void cmGlobalVisualStudio7Generator
extensibilityAddInsOverridden = true; extensibilityAddInsOverridden = true;
fout << "\tGlobalSection(" << name << ") = " << sectionType << "\n"; fout << "\tGlobalSection(" << name << ") = " << sectionType << "\n";
std::vector<std::string> keyValuePairs; std::vector<std::string> keyValuePairs;
cmSystemTools::ExpandListArgument(itProp->second.GetValue(), cmSystemTools::ExpandListArgument(
root->GetMakefile()->GetProperty(it->c_str()),
keyValuePairs); keyValuePairs);
for(std::vector<std::string>::const_iterator itPair = for(std::vector<std::string>::const_iterator itPair =
keyValuePairs.begin(); itPair != keyValuePairs.end(); ++itPair) keyValuePairs.begin(); itPair != keyValuePairs.end(); ++itPair)

View File

@ -4367,6 +4367,18 @@ bool cmMakefile::GetPropertyAsBool(const std::string& prop) const
return cmSystemTools::IsOn(this->GetProperty(prop)); return cmSystemTools::IsOn(this->GetProperty(prop));
} }
std::vector<std::string> cmMakefile::GetPropertyKeys() const
{
std::vector<std::string> keys;
keys.reserve(this->Properties.size());
for(cmPropertyMap::const_iterator it = this->Properties.begin();
it != this->Properties.end(); ++it)
{
keys.push_back(it->first);
}
return keys;
}
cmTarget* cmMakefile::FindTarget(const std::string& name, cmTarget* cmMakefile::FindTarget(const std::string& name,
bool excludeAliases) const bool excludeAliases) const
{ {

View File

@ -700,6 +700,7 @@ public:
const char *GetProperty(const std::string& prop) const; const char *GetProperty(const std::string& prop) const;
const char *GetProperty(const std::string& prop, bool chain) const; const char *GetProperty(const std::string& prop, bool chain) const;
bool GetPropertyAsBool(const std::string& prop) const; bool GetPropertyAsBool(const std::string& prop) const;
std::vector<std::string> GetPropertyKeys() const;
// Get the properties // Get the properties
cmPropertyMap &GetProperties() { return this->Properties; } cmPropertyMap &GetProperties() { return this->Properties; }