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

Method Evaluate

Source/cmGeneratorExpressionNode.cxx:516–538  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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
541static const struct TargetNameIfExistsNode : 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