mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 08:20:18 -06:00
cmMakefile: Add GetOrCreateSourceGroup methods
This commit is contained in:
@@ -2010,6 +2010,27 @@ void cmMakefile::AddSourceGroup(const std::vector<std::string>& name,
|
||||
sg->SetGroupRegex(regex);
|
||||
}
|
||||
|
||||
cmSourceGroup* cmMakefile::GetOrCreateSourceGroup(
|
||||
const std::vector<std::string>& folders)
|
||||
{
|
||||
cmSourceGroup* sg = this->GetSourceGroup(folders);
|
||||
if (sg == nullptr) {
|
||||
this->AddSourceGroup(folders);
|
||||
sg = this->GetSourceGroup(folders);
|
||||
}
|
||||
return sg;
|
||||
}
|
||||
|
||||
cmSourceGroup* cmMakefile::GetOrCreateSourceGroup(const std::string& name)
|
||||
{
|
||||
const char* delimiter = this->GetDefinition("SOURCE_GROUP_DELIMITER");
|
||||
if (delimiter == nullptr) {
|
||||
delimiter = "\\";
|
||||
}
|
||||
return this->GetOrCreateSourceGroup(
|
||||
cmSystemTools::tokenize(name, delimiter));
|
||||
}
|
||||
|
||||
/**
|
||||
* Find a source group whose regular expression matches the filename
|
||||
* part of the given source name. Search backward through the list of
|
||||
|
||||
@@ -474,6 +474,18 @@ public:
|
||||
void AddSourceGroup(const std::vector<std::string>& name,
|
||||
const char* regex = nullptr);
|
||||
|
||||
/**
|
||||
* Get and existing or create a new source group.
|
||||
*/
|
||||
cmSourceGroup* GetOrCreateSourceGroup(
|
||||
const std::vector<std::string>& folders);
|
||||
|
||||
/**
|
||||
* Get and existing or create a new source group.
|
||||
* The name will be tokenized.
|
||||
*/
|
||||
cmSourceGroup* GetOrCreateSourceGroup(const std::string& name);
|
||||
|
||||
/**
|
||||
* find what source group this source is in
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user