mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-01 03:29:18 -05:00
cmMakefile: Collect source group methods in one place
This commit is contained in:
+31
-34
@@ -2010,6 +2010,37 @@ void cmMakefile::AddSourceGroup(const std::vector<std::string>& name,
|
|||||||
sg->SetGroupRegex(regex);
|
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
|
#endif
|
||||||
|
|
||||||
static bool mightExpandVariablesCMP0019(const char* s)
|
static bool mightExpandVariablesCMP0019(const char* s)
|
||||||
@@ -2818,40 +2849,6 @@ std::string cmMakefile::GetConfigurations(std::vector<std::string>& configs,
|
|||||||
return buildType;
|
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,
|
bool cmMakefile::IsFunctionBlocked(const cmListFileFunction& lff,
|
||||||
cmExecutionStatus& status)
|
cmExecutionStatus& status)
|
||||||
{
|
{
|
||||||
|
|||||||
+18
-23
@@ -270,21 +270,6 @@ public:
|
|||||||
bool excludeFromAll = false);
|
bool excludeFromAll = false);
|
||||||
void AddAlias(const std::string& libname, const std::string& tgt);
|
void AddAlias(const std::string& libname, const std::string& tgt);
|
||||||
|
|
||||||
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
|
||||||
/**
|
|
||||||
* Add a root source group for consideration when adding a new source.
|
|
||||||
*/
|
|
||||||
void AddSourceGroup(const std::string& name, const char* regex = nullptr);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a source group for consideration when adding a new source.
|
|
||||||
* name is tokenized.
|
|
||||||
*/
|
|
||||||
void AddSourceGroup(const std::vector<std::string>& name,
|
|
||||||
const char* regex = nullptr);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//@{
|
//@{
|
||||||
/**
|
/**
|
||||||
* Set, Push, Pop policy values for CMake.
|
* Set, Push, Pop policy values for CMake.
|
||||||
@@ -476,6 +461,24 @@ public:
|
|||||||
* Get the source group
|
* Get the source group
|
||||||
*/
|
*/
|
||||||
cmSourceGroup* GetSourceGroup(const std::vector<std::string>& name) const;
|
cmSourceGroup* GetSourceGroup(const std::vector<std::string>& name) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a root source group for consideration when adding a new source.
|
||||||
|
*/
|
||||||
|
void AddSourceGroup(const std::string& name, const char* regex = nullptr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a source group for consideration when adding a new source.
|
||||||
|
* name is tokenized.
|
||||||
|
*/
|
||||||
|
void AddSourceGroup(const std::vector<std::string>& name,
|
||||||
|
const char* regex = nullptr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* find what source group this source is in
|
||||||
|
*/
|
||||||
|
cmSourceGroup* FindSourceGroup(const char* source,
|
||||||
|
std::vector<cmSourceGroup>& groups) const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -552,14 +555,6 @@ public:
|
|||||||
bool atOnly, bool escapeQuotes,
|
bool atOnly, bool escapeQuotes,
|
||||||
cmNewLineStyle = cmNewLineStyle());
|
cmNewLineStyle = cmNewLineStyle());
|
||||||
|
|
||||||
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
|
||||||
/**
|
|
||||||
* find what source group this source is in
|
|
||||||
*/
|
|
||||||
cmSourceGroup* FindSourceGroup(const char* source,
|
|
||||||
std::vector<cmSourceGroup>& groups) const;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print a command's invocation
|
* Print a command's invocation
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user