/src/CMake/Source/cmGeneratorExpressionNode.h
Line | Count | Source |
1 | | /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying |
2 | | file LICENSE.rst or https://cmake.org/licensing for details. */ |
3 | | #pragma once |
4 | | |
5 | | #include "cmConfigure.h" // IWYU pragma: keep |
6 | | |
7 | | #include <string> |
8 | | #include <vector> |
9 | | |
10 | | namespace cm { |
11 | | namespace GenEx { |
12 | | struct Evaluation; |
13 | | } |
14 | | } |
15 | | |
16 | | class cmGeneratorTarget; |
17 | | struct GeneratorExpressionContent; |
18 | | struct cmGeneratorExpressionDAGChecker; |
19 | | |
20 | | struct cmGeneratorExpressionNode |
21 | | { |
22 | | enum |
23 | | { |
24 | | DynamicParameters = 0, |
25 | | OneOrMoreParameters = -1, |
26 | | TwoOrMoreParameters = -2, |
27 | | ZeroOrMoreParameters = -3, |
28 | | OneOrZeroParameters = -4 |
29 | | }; |
30 | 0 | virtual ~cmGeneratorExpressionNode() = default; |
31 | | |
32 | 0 | virtual bool GeneratesContent() const { return true; } |
33 | | |
34 | 0 | virtual bool RequiresLiteralInput() const { return false; } |
35 | | |
36 | 0 | virtual bool AcceptsArbitraryContentParameter() const { return false; } |
37 | | |
38 | 0 | virtual int NumExpectedParameters() const { return 1; } |
39 | | |
40 | | virtual bool ShouldEvaluateNextParameter(std::vector<std::string> const&, |
41 | | std::string&) const |
42 | 0 | { |
43 | 0 | return true; |
44 | 0 | } |
45 | | |
46 | | virtual std::string Evaluate( |
47 | | std::vector<std::string> const& parameters, cm::GenEx::Evaluation* eval, |
48 | | GeneratorExpressionContent const* content, |
49 | | cmGeneratorExpressionDAGChecker* dagChecker) const = 0; |
50 | | |
51 | | static std::string EvaluateDependentExpression( |
52 | | std::string const& prop, cm::GenEx::Evaluation* eval, |
53 | | cmGeneratorTarget const* headTarget, |
54 | | cmGeneratorExpressionDAGChecker* dagChecker, |
55 | | cmGeneratorTarget const* currentTarget); |
56 | | |
57 | | static cmGeneratorExpressionNode const* GetNode( |
58 | | std::string const& identifier); |
59 | | }; |
60 | | |
61 | | void reportError(cm::GenEx::Evaluation* eval, std::string const& expr, |
62 | | std::string const& result); |