浏览代码

cmGlobalGenerator: Make NameResolvesToFramework const.

Stephen Kelly 12 年之前
父节点
当前提交
1c2752169c
共有 2 个文件被更改,包括 11 次插入9 次删除
  1. 9 7
      Source/cmGlobalGenerator.cxx
  2. 2 2
      Source/cmGlobalGenerator.h

+ 9 - 7
Source/cmGlobalGenerator.cxx

@@ -1989,15 +1989,16 @@ bool cmGlobalGenerator::IsAlias(const char *name) const
 //----------------------------------------------------------------------------
 cmTarget*
 cmGlobalGenerator::FindTarget(const char* project, const char* name,
-                              bool excludeAliases)
+                              bool excludeAliases) const
 {
   // if project specific
   if(project)
     {
-    std::vector<cmLocalGenerator*>* gens = &this->ProjectMap[project];
-    for(unsigned int i = 0; i < gens->size(); ++i)
+    std::map<cmStdString, std::vector<cmLocalGenerator*> >::const_iterator
+      gens = this->ProjectMap.find(project);
+    for(unsigned int i = 0; i < gens->second.size(); ++i)
       {
-      cmTarget* ret = (*gens)[i]->GetMakefile()->FindTarget(name,
+      cmTarget* ret = (gens->second)[i]->GetMakefile()->FindTarget(name,
                                                             excludeAliases);
       if(ret)
         {
@@ -2010,14 +2011,14 @@ cmGlobalGenerator::FindTarget(const char* project, const char* name,
     {
     if (!excludeAliases)
       {
-      std::map<cmStdString, cmTarget*>::iterator ai
+      std::map<cmStdString, cmTarget*>::const_iterator ai
                                               = this->AliasTargets.find(name);
       if (ai != this->AliasTargets.end())
         {
         return ai->second;
         }
       }
-    std::map<cmStdString,cmTarget *>::iterator i =
+    std::map<cmStdString,cmTarget *>::const_iterator i =
       this->TotalTargets.find ( name );
     if ( i != this->TotalTargets.end() )
       {
@@ -2033,7 +2034,8 @@ cmGlobalGenerator::FindTarget(const char* project, const char* name,
 }
 
 //----------------------------------------------------------------------------
-bool cmGlobalGenerator::NameResolvesToFramework(const std::string& libname)
+bool
+cmGlobalGenerator::NameResolvesToFramework(const std::string& libname) const
 {
   if(cmSystemTools::IsPathToFramework(libname.c_str()))
     {

+ 2 - 2
Source/cmGlobalGenerator.h

@@ -207,14 +207,14 @@ public:
 
   ///! Find a target by name by searching the local generators.
   cmTarget* FindTarget(const char* project, const char* name,
-                       bool excludeAliases = false);
+                       bool excludeAliases = false) const;
 
   void AddAlias(const char *name, cmTarget *tgt);
   bool IsAlias(const char *name) const;
 
   /** Determine if a name resolves to a framework on disk or a built target
       that is a framework. */
-  bool NameResolvesToFramework(const std::string& libname);
+  bool NameResolvesToFramework(const std::string& libname) const;
 
   /** If check to see if the target is linked to by any other
       target in the project */