* Find a source group whose regular expression matches the filename * part of the given source name. Search backward through the list of * source groups, and take the first matching group found. This way * non-inherited SOURCE_GROUP commands will have precedence over * inherited ones. */
| 164 | * inherited ones. |
| 165 | */ |
| 166 | cmSourceGroup* cmSourceGroup::FindSourceGroup(std::string const& source, |
| 167 | SourceGroupVector const& groups) |
| 168 | { |
| 169 | // First search for a group that lists the file explicitly. |
| 170 | for (auto sg = groups.rbegin(); sg != groups.rend(); ++sg) { |
| 171 | cmSourceGroup* result = (*sg)->MatchChildrenFiles(source); |
| 172 | if (result) { |
| 173 | return result; |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | // Now search for a group whose regex matches the file. |
| 178 | for (auto sg = groups.rbegin(); sg != groups.rend(); ++sg) { |
| 179 | cmSourceGroup* result = (*sg)->MatchChildrenRegex(source); |
| 180 | if (result) { |
| 181 | return result; |
| 182 | } |
| 183 | } |
| 184 | |
| 185 | // Shouldn't get here, but just in case, return the default group. |
| 186 | return groups.data()->get(); |
| 187 | } |
| 188 | |
| 189 | void cmSourceGroupFiles::Add(cmSourceGroup const* sg, cmSourceFile const* sf) |
| 190 | { |
no test coverage detected