| 3581 | |
| 3582 | namespace { |
| 3583 | bool GetFileSet(std::vector<std::string> const& parameters, |
| 3584 | cm::GenEx::Evaluation* eval, |
| 3585 | GeneratorExpressionContent const* content, cmFileSet*& fileSet) |
| 3586 | { |
| 3587 | auto const& fileSetName = parameters[0]; |
| 3588 | auto targetName = parameters[1]; |
| 3589 | auto* makefile = eval->Context.LG->GetMakefile(); |
| 3590 | fileSet = nullptr; |
| 3591 | |
| 3592 | auto const TARGET = "TARGET:"_s; |
| 3593 | |
| 3594 | if (cmHasPrefix(targetName, TARGET)) { |
| 3595 | targetName = targetName.substr(TARGET.length()); |
| 3596 | if (targetName.empty()) { |
| 3597 | reportError(eval, content->GetOriginalExpression(), |
| 3598 | cmStrCat("No value provided for the ", TARGET, " option.")); |
| 3599 | return false; |
| 3600 | } |
| 3601 | auto* target = makefile->FindTargetToUse(targetName); |
| 3602 | if (!target) { |
| 3603 | reportError(eval, content->GetOriginalExpression(), |
| 3604 | cmStrCat("Non-existent target: ", targetName)); |
| 3605 | return false; |
| 3606 | } |
| 3607 | fileSet = target->GetFileSet(fileSetName); |
| 3608 | } else { |
| 3609 | reportError(eval, content->GetOriginalExpression(), |
| 3610 | cmStrCat("Invalid option. ", TARGET, " expected.")); |
| 3611 | return false; |
| 3612 | } |
| 3613 | return true; |
| 3614 | } |
| 3615 | } |
| 3616 | |
| 3617 | static const struct FileSetExistsNode : public cmGeneratorExpressionNode |
no test coverage detected
searching dependent graphs…