| 545 | int NumExpectedParameters() const override { return 1; } |
| 546 | |
| 547 | std::string Evaluate( |
| 548 | std::vector<std::string> const& parameters, cm::GenEx::Evaluation* eval, |
| 549 | GeneratorExpressionContent const* content, |
| 550 | cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override |
| 551 | { |
| 552 | if (parameters.size() != 1) { |
| 553 | reportError(eval, content->GetOriginalExpression(), |
| 554 | "$<TARGET_NAME_IF_EXISTS:...> expression requires one " |
| 555 | "parameter"); |
| 556 | return std::string(); |
| 557 | } |
| 558 | |
| 559 | std::string const& targetName = parameters.front(); |
| 560 | if (targetName.empty() || |
| 561 | !cmGeneratorExpression::IsValidTargetName(targetName)) { |
| 562 | reportError(eval, content->GetOriginalExpression(), |
| 563 | "$<TARGET_NAME_IF_EXISTS:tgt> expression requires a " |
| 564 | "non-empty valid target name."); |
| 565 | return std::string(); |
| 566 | } |
| 567 | |
| 568 | return eval->Context.LG->GetMakefile()->FindTargetToUse(targetName) |
| 569 | ? targetName |
| 570 | : std::string(); |
| 571 | } |
| 572 | } targetNameIfExistsNode; |
| 573 | |
| 574 | struct GenexEvaluator : public cmGeneratorExpressionNode |
nothing calls this directly
no test coverage detected