| 217 | } |
| 218 | |
| 219 | void cmFileSet::EvaluateFileEntry( |
| 220 | std::vector<std::string> const& dirs, |
| 221 | std::map<std::string, std::vector<std::string>>& filesPerDir, |
| 222 | std::unique_ptr<cmCompiledGeneratorExpression> const& cge, |
| 223 | cm::GenEx::Context const& context, cmGeneratorTarget const* target, |
| 224 | cmGeneratorExpressionDAGChecker* dagChecker) const |
| 225 | { |
| 226 | auto files = cge->Evaluate(context, dagChecker, target); |
| 227 | for (std::string file : cmList{ files }) { |
| 228 | if (!cmSystemTools::FileIsFullPath(file)) { |
| 229 | file = cmStrCat(context.LG->GetCurrentSourceDirectory(), '/', file); |
| 230 | } |
| 231 | auto collapsedFile = cmSystemTools::CollapseFullPath(file); |
| 232 | bool found = false; |
| 233 | std::string relDir; |
| 234 | for (auto const& dir : dirs) { |
| 235 | auto collapsedDir = cmSystemTools::CollapseFullPath(dir); |
| 236 | if (cmSystemTools::IsSubDirectory(collapsedFile, collapsedDir)) { |
| 237 | found = true; |
| 238 | relDir = cmSystemTools::GetParentDirectory( |
| 239 | cmSystemTools::RelativePath(collapsedDir, collapsedFile)); |
| 240 | break; |
| 241 | } |
| 242 | } |
| 243 | if (!found) { |
| 244 | std::ostringstream e; |
| 245 | e << "File:\n " << file |
| 246 | << "\nmust be in one of the file set's base directories:"; |
| 247 | for (auto const& dir : dirs) { |
| 248 | e << "\n " << dir; |
| 249 | } |
| 250 | context.LG->GetCMakeInstance()->IssueMessage( |
| 251 | MessageType::FATAL_ERROR, e.str(), cge->GetBacktrace()); |
| 252 | return; |
| 253 | } |
| 254 | |
| 255 | filesPerDir[relDir].push_back(file); |
| 256 | } |
| 257 | } |
| 258 | |
| 259 | bool cmFileSet::IsValidName(std::string const& name) |
| 260 | { |
no test coverage detected