| 3931 | } |
| 3932 | |
| 3933 | std::string Evaluate( |
| 3934 | std::vector<std::string> const& parameters, cm::GenEx::Evaluation* eval, |
| 3935 | GeneratorExpressionContent const* content, |
| 3936 | cmGeneratorExpressionDAGChecker* dagCheckerParent) const override |
| 3937 | { |
| 3938 | static cmsys::RegularExpression propertyNameValidator("^[A-Za-z0-9_]+$"); |
| 3939 | |
| 3940 | cmGeneratorTarget const* target = nullptr; |
| 3941 | std::string targetName; |
| 3942 | std::string propertyName; |
| 3943 | |
| 3944 | if (parameters.size() == 2) { |
| 3945 | targetName = parameters[0]; |
| 3946 | propertyName = parameters[1]; |
| 3947 | |
| 3948 | if (char const* e = GetErrorText(targetName, propertyName)) { |
| 3949 | reportError(eval, content->GetOriginalExpression(), e); |
| 3950 | return std::string(); |
| 3951 | } |
| 3952 | if (propertyName == "ALIASED_TARGET"_s) { |
| 3953 | if (eval->Context.LG->GetMakefile()->IsAlias(targetName)) { |
| 3954 | if (cmGeneratorTarget* tgt = |
| 3955 | eval->Context.LG->FindGeneratorTargetToUse(targetName)) { |
| 3956 | return tgt->GetName(); |
| 3957 | } |
| 3958 | } |
| 3959 | return std::string(); |
| 3960 | } |
| 3961 | if (propertyName == "ALIAS_GLOBAL"_s) { |
| 3962 | if (eval->Context.LG->GetMakefile()->IsAlias(targetName)) { |
| 3963 | return eval->Context.LG->GetGlobalGenerator()->IsAlias(targetName) |
| 3964 | ? "TRUE" |
| 3965 | : "FALSE"; |
| 3966 | } |
| 3967 | return std::string(); |
| 3968 | } |
| 3969 | cmLocalGenerator const* lg = eval->CurrentTarget |
| 3970 | ? eval->CurrentTarget->GetLocalGenerator() |
| 3971 | : eval->Context.LG; |
| 3972 | target = lg->FindGeneratorTargetToUse(targetName); |
| 3973 | |
| 3974 | if (!target) { |
| 3975 | std::ostringstream e; |
| 3976 | e << "Target \"" << targetName << "\" not found."; |
| 3977 | reportError(eval, content->GetOriginalExpression(), e.str()); |
| 3978 | return std::string(); |
| 3979 | } |
| 3980 | eval->AllTargets.insert(target); |
| 3981 | |
| 3982 | } else if (parameters.size() == 1) { |
| 3983 | target = eval->HeadTarget; |
| 3984 | propertyName = parameters[0]; |
| 3985 | |
| 3986 | // Keep track of the properties seen while processing. |
| 3987 | // The evaluation of the LINK_LIBRARIES generator expressions |
| 3988 | // will check this to ensure that properties have one consistent |
| 3989 | // value for all evaluations. |
| 3990 | eval->SeenTargetProperties.insert(propertyName); |
nothing calls this directly
no test coverage detected