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

Method Evaluate

Source/cmGeneratorExpressionNode.cxx:3775–3800  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3773 int NumExpectedParameters() const override { return OneOrMoreParameters; }
3774
3775 std::string Evaluate(
3776 std::vector<std::string> const& parameters, cm::GenEx::Evaluation* eval,
3777 GeneratorExpressionContent const* content,
3778 cmGeneratorExpressionDAGChecker* /*dagCheckerParent*/) const override
3779 {
3780 if (parameters.size() > 2) {
3781 reportError(eval, content->GetOriginalExpression(),
3782 "$<SOURCE_EXISTS:...> expression requires at most two "
3783 "parameters.");
3784 return std::string{};
3785 }
3786
3787 if (parameters[0].empty()) {
3788 reportError(eval, content->GetOriginalExpression(),
3789 "$<SOURCE_EXISTS:src> expression requires a "
3790 "non-empty source name.");
3791 return std::string{};
3792 }
3793
3794 cmSourceFile* sourceFile = nullptr;
3795 if (!GetSourceFile(cmMakeRange(parameters), eval, content, sourceFile)) {
3796 return std::string{};
3797 }
3798
3799 return sourceFile ? "1" : "0";
3800 }
3801} sourceExistsNode;
3802
3803static const struct SourcePropertyNode : public cmGeneratorExpressionNode

Callers

nothing calls this directly

Calls 6

reportErrorFunction · 0.85
GetSourceFileFunction · 0.85
cmMakeRangeFunction · 0.85
GetOriginalExpressionMethod · 0.80
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected