cmGeneratorExpressionNode.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. #include "cmConfigure.h" // IWYU pragma: keep
  5. #include <string>
  6. #include <vector>
  7. namespace cm {
  8. namespace GenEx {
  9. struct Evaluation;
  10. }
  11. }
  12. class cmGeneratorTarget;
  13. struct GeneratorExpressionContent;
  14. struct cmGeneratorExpressionDAGChecker;
  15. struct cmGeneratorExpressionNode
  16. {
  17. enum
  18. {
  19. DynamicParameters = 0,
  20. OneOrMoreParameters = -1,
  21. TwoOrMoreParameters = -2,
  22. ZeroOrMoreParameters = -3,
  23. OneOrZeroParameters = -4
  24. };
  25. virtual ~cmGeneratorExpressionNode() = default;
  26. virtual bool GeneratesContent() const { return true; }
  27. virtual bool RequiresLiteralInput() const { return false; }
  28. virtual bool AcceptsArbitraryContentParameter() const { return false; }
  29. virtual int NumExpectedParameters() const { return 1; }
  30. virtual bool ShouldEvaluateNextParameter(std::vector<std::string> const&,
  31. std::string&) const
  32. {
  33. return true;
  34. }
  35. virtual std::string Evaluate(
  36. std::vector<std::string> const& parameters, cm::GenEx::Evaluation* eval,
  37. GeneratorExpressionContent const* content,
  38. cmGeneratorExpressionDAGChecker* dagChecker) const = 0;
  39. static std::string EvaluateDependentExpression(
  40. std::string const& prop, cm::GenEx::Evaluation* eval,
  41. cmGeneratorTarget const* headTarget,
  42. cmGeneratorExpressionDAGChecker* dagChecker,
  43. cmGeneratorTarget const* currentTarget);
  44. static cmGeneratorExpressionNode const* GetNode(
  45. std::string const& identifier);
  46. };
  47. void reportError(cm::GenEx::Evaluation* eval, std::string const& expr,
  48. std::string const& result);