瀏覽代碼

cmMakefile: Add a PropertyKeys accessor.

Stephen Kelly 10 年之前
父節點
當前提交
cbe3ee58ca
共有 3 個文件被更改,包括 22 次插入7 次删除
  1. 9 7
      Source/cmGlobalVisualStudio7Generator.cxx
  2. 12 0
      Source/cmMakefile.cxx
  3. 1 0
      Source/cmMakefile.h

+ 9 - 7
Source/cmGlobalVisualStudio7Generator.cxx

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

+ 12 - 0
Source/cmMakefile.cxx

@@ -4367,6 +4367,18 @@ bool cmMakefile::GetPropertyAsBool(const std::string& prop) const
   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,
                                  bool excludeAliases) const
 {

+ 1 - 0
Source/cmMakefile.h

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