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

Method Evaluate

Source/cmGeneratorExpressionNode.cxx:3653–3701  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3651 int NumExpectedParameters() const override { return 3; }
3652
3653 std::string Evaluate(
3654 std::vector<std::string> const& parameters, cm::GenEx::Evaluation* eval,
3655 GeneratorExpressionContent const* content,
3656 cmGeneratorExpressionDAGChecker* /*dagCheckerParent*/) const override
3657 {
3658 static cmsys::RegularExpression propertyNameValidator("^[A-Za-z0-9_]+$");
3659
3660 std::string const& fileSetName = parameters.front();
3661 std::string const& propertyName = parameters.back();
3662
3663 if (fileSetName.empty() && propertyName.empty()) {
3664 reportError(eval, content->GetOriginalExpression(),
3665 "$<FILE_SET_PROPERTY:fileset,TARGET:tgt,prop> expression "
3666 "requires a non-empty FILE_SET name and property name.");
3667 return std::string{};
3668 }
3669 if (fileSetName.empty()) {
3670 reportError(
3671 eval, content->GetOriginalExpression(),
3672 "$<FILE_SET_PROPERTY:fileset,TARGET:tgt,prop> expression requires a "
3673 "non-empty FILE_SET name.");
3674 return std::string{};
3675 }
3676 if (propertyName.empty()) {
3677 reportError(
3678 eval, content->GetOriginalExpression(),
3679 "$<FILE_SET_PROPERTY:fileset,TARGET:tgt,prop> expression requires a "
3680 "non-empty property name.");
3681 return std::string{};
3682 }
3683 if (!propertyNameValidator.find(propertyName)) {
3684 reportError(eval, content->GetOriginalExpression(),
3685 "Property name not supported.");
3686 return std::string{};
3687 }
3688
3689 cmFileSet* fileSet = nullptr;
3690 if (!GetFileSet(parameters, eval, content, fileSet)) {
3691 return std::string{};
3692 }
3693 if (!fileSet) {
3694 reportError(
3695 eval, content->GetOriginalExpression(),
3696 cmStrCat("FILE_SET \"", fileSetName, "\" is not known from CMake."));
3697 return std::string{};
3698 }
3699
3700 return fileSet->GetProperty(propertyName);
3701 }
3702} fileSetPropertyNode;
3703
3704namespace {

Callers

nothing calls this directly

Calls 9

reportErrorFunction · 0.85
GetFileSetFunction · 0.85
GetOriginalExpressionMethod · 0.80
cmStrCatFunction · 0.70
frontMethod · 0.45
backMethod · 0.45
emptyMethod · 0.45
findMethod · 0.45
GetPropertyMethod · 0.45

Tested by

no test coverage detected