| 3808 | int NumExpectedParameters() const override { return TwoOrMoreParameters; } |
| 3809 | |
| 3810 | std::string Evaluate( |
| 3811 | std::vector<std::string> const& parameters, cm::GenEx::Evaluation* eval, |
| 3812 | GeneratorExpressionContent const* content, |
| 3813 | cmGeneratorExpressionDAGChecker* /*dagCheckerParent*/) const override |
| 3814 | { |
| 3815 | static cmsys::RegularExpression propertyNameValidator("^[A-Za-z0-9_]+$"); |
| 3816 | |
| 3817 | if (parameters.size() > 3) { |
| 3818 | reportError(eval, content->GetOriginalExpression(), |
| 3819 | "$<SOURCE_PROPERTY:...> expression requires at most three " |
| 3820 | "parameters."); |
| 3821 | return std::string{}; |
| 3822 | } |
| 3823 | |
| 3824 | std::string sourceName = parameters.front(); |
| 3825 | std::string const& propertyName = parameters.back(); |
| 3826 | |
| 3827 | if (sourceName.empty() && propertyName.empty()) { |
| 3828 | reportError(eval, content->GetOriginalExpression(), |
| 3829 | "$<SOURCE_PROPERTY:src,prop> expression requires a " |
| 3830 | "non-empty source name and property name."); |
| 3831 | return std::string{}; |
| 3832 | } |
| 3833 | if (sourceName.empty()) { |
| 3834 | reportError(eval, content->GetOriginalExpression(), |
| 3835 | "$<SOURCE_PROPERTY:src,prop> expression requires a " |
| 3836 | "non-empty source name."); |
| 3837 | return std::string{}; |
| 3838 | } |
| 3839 | if (propertyName.empty()) { |
| 3840 | reportError(eval, content->GetOriginalExpression(), |
| 3841 | "$<SOURCE_PROPERTY:src,prop> expression requires a " |
| 3842 | "non-empty property name."); |
| 3843 | return std::string{}; |
| 3844 | } |
| 3845 | if (!propertyNameValidator.find(propertyName)) { |
| 3846 | reportError(eval, content->GetOriginalExpression(), |
| 3847 | "Property name not supported."); |
| 3848 | return std::string{}; |
| 3849 | } |
| 3850 | |
| 3851 | cmSourceFile* sourceFile = nullptr; |
| 3852 | if (!GetSourceFile(cmMakeRange(parameters).retreat(1), eval, content, |
| 3853 | sourceFile)) { |
| 3854 | return std::string{}; |
| 3855 | } |
| 3856 | if (!sourceFile) { |
| 3857 | reportError( |
| 3858 | eval, content->GetOriginalExpression(), |
| 3859 | cmStrCat("Source file \"", sourceName, "\" is not known from CMake.")); |
| 3860 | return std::string{}; |
| 3861 | } |
| 3862 | |
| 3863 | return sourceFile->GetPropertyForUser(propertyName); |
| 3864 | } |
| 3865 | } sourcePropertyNode; |
| 3866 | |
| 3867 | static std::string getLinkedTargetsContent( |
nothing calls this directly
no test coverage detected