\class cmGeneratorExpression * \brief Evaluate generate-time query expression syntax. * * cmGeneratorExpression instances are used by build system generator * implementations to evaluate the $<> generator expression syntax. * Generator expressions are evaluated just before the generate step * writes strings into the build system. They have knowledge of the * build configuration which is no
| 38 | * build configuration which is not available at configure time. |
| 39 | */ |
| 40 | class cmGeneratorExpression |
| 41 | { |
| 42 | public: |
| 43 | /** Construct. */ |
| 44 | cmGeneratorExpression(cmake& cmakeInstance, |
| 45 | cmListFileBacktrace backtrace = cmListFileBacktrace()); |
| 46 | ~cmGeneratorExpression(); |
| 47 | |
| 48 | cmGeneratorExpression(cmGeneratorExpression const&) = delete; |
| 49 | cmGeneratorExpression& operator=(cmGeneratorExpression const&) = delete; |
| 50 | |
| 51 | std::unique_ptr<cmCompiledGeneratorExpression> Parse( |
| 52 | std::string input) const; |
| 53 | |
| 54 | static std::string Evaluate( |
| 55 | std::string input, cmLocalGenerator const* lg, std::string const& config, |
| 56 | cmGeneratorTarget const* headTarget = nullptr, |
| 57 | cmGeneratorExpressionDAGChecker* dagChecker = nullptr, |
| 58 | cmGeneratorTarget const* currentTarget = nullptr, |
| 59 | std::string const& language = std::string()); |
| 60 | |
| 61 | static bool ForbidGeneratorExpressions( |
| 62 | cmGeneratorTarget const* target, std::string const& propertyName, |
| 63 | std::string const& propertyValue, std::string& evaluatedValue, |
| 64 | std::map<std::string, std::vector<std::string>>& allowList); |
| 65 | |
| 66 | static bool ForbidGeneratorExpressions(cmGeneratorTarget const* target, |
| 67 | std::string const& propertyName, |
| 68 | std::string const& propertyValue); |
| 69 | |
| 70 | enum PreprocessContext |
| 71 | { |
| 72 | StripAllGeneratorExpressions, |
| 73 | BuildInterface, |
| 74 | InstallInterface |
| 75 | }; |
| 76 | |
| 77 | static std::string Preprocess(cm::string_view input, |
| 78 | PreprocessContext context, |
| 79 | cm::string_view importPrefix = {}); |
| 80 | |
| 81 | static std::string Collect( |
| 82 | std::string const& input, |
| 83 | std::map<std::string, std::vector<std::string>>& collected); |
| 84 | |
| 85 | static void Split(std::string const& input, |
| 86 | std::vector<std::string>& output); |
| 87 | |
| 88 | static cm::string_view::size_type Find(cm::string_view input); |
| 89 | |
| 90 | static bool IsValidTargetName(std::string const& input); |
| 91 | |
| 92 | static std::string StripEmptyListElements(std::string const& input); |
| 93 | |
| 94 | static bool StartsWithGeneratorExpression(std::string const& input) |
| 95 | { |
| 96 | return input.length() >= 2 && input[0] == '$' && input[1] == '<'; |
| 97 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…