cmGeneratorExpression.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #include "cmStandardIncludes.h"
  11. #include <stack>
  12. #include <cmsys/RegularExpression.hxx>
  13. class cmMakefile;
  14. class cmListFileBacktrace;
  15. /** \class cmGeneratorExpression
  16. * \brief Evaluate generate-time query expression syntax.
  17. *
  18. * cmGeneratorExpression instances are used by build system generator
  19. * implementations to evaluate the $<> generator expression syntax.
  20. * Generator expressions are evaluated just before the generate step
  21. * writes strings into the build system. They have knowledge of the
  22. * build configuration which is not available at configure time.
  23. */
  24. class cmGeneratorExpression
  25. {
  26. public:
  27. /** Construct with an evaluation context and configuration. */
  28. cmGeneratorExpression(cmMakefile* mf, const char* config,
  29. cmListFileBacktrace const& backtrace,
  30. bool quiet = false);
  31. /** Evaluate generator expressions in a string. */
  32. const char* Process(std::string const& input);
  33. const char* Process(const char* input);
  34. private:
  35. cmMakefile* Makefile;
  36. const char* Config;
  37. cmListFileBacktrace const& Backtrace;
  38. bool Quiet;
  39. std::vector<char> Data;
  40. std::stack<size_t> Barriers;
  41. cmsys::RegularExpression TargetInfo;
  42. bool Evaluate();
  43. bool Evaluate(const char* expr, std::string& result);
  44. bool EvaluateTargetInfo(std::string& result);
  45. };