diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2017-09-07 09:42:29 (GMT) |
---|---|---|
committer | Sebastian Holtermann <sebholt@xwmw.org> | 2017-09-09 07:44:55 (GMT) |
commit | 3e8b3e94dc6d3ea59dd437f1ea46786f9f0ec1d2 (patch) | |
tree | be9993d25925036d0dc5a86f8b4b634beba83319 /Source/cmMakefile.cxx | |
parent | e18ab9c4b2fc3b11a1e246b1418d25382a853bfb (diff) | |
download | CMake-3e8b3e94dc6d3ea59dd437f1ea46786f9f0ec1d2.zip CMake-3e8b3e94dc6d3ea59dd437f1ea46786f9f0ec1d2.tar.gz CMake-3e8b3e94dc6d3ea59dd437f1ea46786f9f0ec1d2.tar.bz2 |
cmMakefile: Collect source group methods in one place
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r-- | Source/cmMakefile.cxx | 65 |
1 files changed, 31 insertions, 34 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 230c210..24c2de2 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2010,6 +2010,37 @@ void cmMakefile::AddSourceGroup(const std::vector<std::string>& name, sg->SetGroupRegex(regex); } +/** + * 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. + */ +cmSourceGroup* cmMakefile::FindSourceGroup( + const char* source, std::vector<cmSourceGroup>& groups) const +{ + // First search for a group that lists the file explicitly. + for (std::vector<cmSourceGroup>::reverse_iterator sg = groups.rbegin(); + sg != groups.rend(); ++sg) { + cmSourceGroup* result = sg->MatchChildrenFiles(source); + if (result) { + return result; + } + } + + // Now search for a group whose regex matches the file. + for (std::vector<cmSourceGroup>::reverse_iterator sg = groups.rbegin(); + sg != groups.rend(); ++sg) { + cmSourceGroup* result = sg->MatchChildrenRegex(source); + if (result) { + return result; + } + } + + // Shouldn't get here, but just in case, return the default group. + return &groups.front(); +} #endif static bool mightExpandVariablesCMP0019(const char* s) @@ -2818,40 +2849,6 @@ std::string cmMakefile::GetConfigurations(std::vector<std::string>& configs, return buildType; } -#if defined(CMAKE_BUILD_WITH_CMAKE) -/** - * 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. - */ -cmSourceGroup* cmMakefile::FindSourceGroup( - const char* source, std::vector<cmSourceGroup>& groups) const -{ - // First search for a group that lists the file explicitly. - for (std::vector<cmSourceGroup>::reverse_iterator sg = groups.rbegin(); - sg != groups.rend(); ++sg) { - cmSourceGroup* result = sg->MatchChildrenFiles(source); - if (result) { - return result; - } - } - - // Now search for a group whose regex matches the file. - for (std::vector<cmSourceGroup>::reverse_iterator sg = groups.rbegin(); - sg != groups.rend(); ++sg) { - cmSourceGroup* result = sg->MatchChildrenRegex(source); - if (result) { - return result; - } - } - - // Shouldn't get here, but just in case, return the default group. - return &groups.front(); -} -#endif - bool cmMakefile::IsFunctionBlocked(const cmListFileFunction& lff, cmExecutionStatus& status) { |