MCPcopy Create free account
hub / github.com/Kitware/CMake / addFilesToItsSourceGroups

Function addFilesToItsSourceGroups

Source/cmSourceGroupCommand.cxx:85–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83}
84
85bool addFilesToItsSourceGroups(std::string const& root,
86 std::set<std::string> const& sgFilesPaths,
87 std::string const& prefix, cmMakefile& makefile,
88 std::string& errorMsg)
89{
90 cmSourceGroup* sg;
91
92 for (std::string const& sgFilesPath : sgFilesPaths) {
93 std::vector<std::string> tokenizedPath = cmTokenize(
94 prefix.empty() ? sgFilesPath : cmStrCat(prefix, '/', sgFilesPath),
95 R"(\/)", cmTokenizerMode::New);
96
97 if (tokenizedPath.empty()) {
98 continue;
99 }
100 tokenizedPath.pop_back();
101
102 if (tokenizedPath.empty()) {
103 tokenizedPath.emplace_back();
104 }
105
106 sg = makefile.GetOrCreateSourceGroup(tokenizedPath);
107
108 if (!sg) {
109 errorMsg = "Could not create source group for file: " + sgFilesPath;
110 return false;
111 }
112 std::string const fullPath =
113 cmSystemTools::CollapseFullPath(sgFilesPath, root);
114 sg->AddGroupFile(fullPath);
115 }
116
117 return true;
118}
119
120ExpectedOptions getExpectedOptions()
121{

Callers 1

processTreeFunction · 0.85

Calls 7

cmTokenizeFunction · 0.85
pop_backMethod · 0.80
emplace_backMethod · 0.80
AddGroupFileMethod · 0.80
cmStrCatFunction · 0.70
emptyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…