MCPcopy Create free account
hub / github.com/Kitware/CMake / Evaluate

Method Evaluate

Source/cmGeneratorExpressionNode.cxx:547–571  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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
574struct GenexEvaluator : public cmGeneratorExpressionNode

Callers

nothing calls this directly

Calls 7

reportErrorFunction · 0.85
GetOriginalExpressionMethod · 0.80
FindTargetToUseMethod · 0.80
sizeMethod · 0.45
frontMethod · 0.45
emptyMethod · 0.45
GetMakefileMethod · 0.45

Tested by

no test coverage detected