| 83 | } |
| 84 | |
| 85 | bool 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 | |
| 120 | ExpectedOptions getExpectedOptions() |
| 121 | { |
no test coverage detected
searching dependent graphs…