Imported Upstream version 2.8.11.2
[platform/upstream/cmake.git] / Source / cmSourceGroup.cxx
index 2b34f2b..f09976f 100644 (file)
@@ -71,13 +71,13 @@ void cmSourceGroup::SetGroupRegex(const char* regex)
     this->GroupRegex.compile("^$");
     }
 }
-  
+
 //----------------------------------------------------------------------------
 void cmSourceGroup::AddGroupFile(const char* name)
 {
   this->GroupFiles.insert(name);
 }
-  
+
 //----------------------------------------------------------------------------
 const char* cmSourceGroup::GetName() const
 {
@@ -89,7 +89,7 @@ const char* cmSourceGroup::GetFullName() const
 {
   return this->FullName.c_str();
 }
-  
+
 //----------------------------------------------------------------------------
 bool cmSourceGroup::MatchesRegex(const char* name)
 {
@@ -137,12 +137,12 @@ cmSourceGroup *cmSourceGroup::lookupChild(const char* name)
   // st
   for(;iter!=end; ++iter)
     {
-    std::string sgName = iter->GetName(); 
+    std::string sgName = iter->GetName();
 
     // look if descenened is the one were looking for
     if(sgName == name)
       {
-      return &(*iter); // if it so return it 
+      return &(*iter); // if it so return it
       }
     }
 
@@ -182,10 +182,6 @@ cmSourceGroup *cmSourceGroup::MatchChildrenRegex(const char *name)
   std::vector<cmSourceGroup>::iterator end =
     this->Internal->GroupChildren.end();
 
-  if(this->MatchesRegex(name))
-    {
-    return this;
-    }
   for(;iter!=end; ++iter)
     {
     cmSourceGroup *result = iter->MatchChildrenRegex(name);
@@ -194,6 +190,11 @@ cmSourceGroup *cmSourceGroup::MatchChildrenRegex(const char *name)
       return result;
       }
     }
+  if(this->MatchesRegex(name))
+    {
+    return this;
+    }
+
   return 0;
 }