| 514 | int NumExpectedParameters() const override { return 1; } |
| 515 | |
| 516 | std::string Evaluate( |
| 517 | std::vector<std::string> const& parameters, cm::GenEx::Evaluation* eval, |
| 518 | GeneratorExpressionContent const* content, |
| 519 | cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override |
| 520 | { |
| 521 | if (parameters.size() != 1) { |
| 522 | reportError(eval, content->GetOriginalExpression(), |
| 523 | "$<TARGET_EXISTS:...> expression requires one parameter"); |
| 524 | return std::string(); |
| 525 | } |
| 526 | |
| 527 | std::string const& targetName = parameters.front(); |
| 528 | if (targetName.empty() || |
| 529 | !cmGeneratorExpression::IsValidTargetName(targetName)) { |
| 530 | reportError(eval, content->GetOriginalExpression(), |
| 531 | "$<TARGET_EXISTS:tgt> expression requires a non-empty " |
| 532 | "valid target name."); |
| 533 | return std::string(); |
| 534 | } |
| 535 | |
| 536 | return eval->Context.LG->GetMakefile()->FindTargetToUse(targetName) ? "1" |
| 537 | : "0"; |
| 538 | } |
| 539 | } targetExistsNode; |
| 540 | |
| 541 | static const struct TargetNameIfExistsNode : public cmGeneratorExpressionNode |
nothing calls this directly
no test coverage detected