diff --git a/Source/cmSourceGroup.cxx b/Source/cmSourceGroup.cxx index 4fd98518b..f09976f44 100644 --- a/Source/cmSourceGroup.cxx +++ b/Source/cmSourceGroup.cxx @@ -182,10 +182,6 @@ cmSourceGroup *cmSourceGroup::MatchChildrenRegex(const char *name) std::vector::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; }