cmGeneratorExpression.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. /** Evaluate generator expressions in a string. */
  31. const char* Process(std::string const& input);
  32. const char* Process(const char* input);
  33. private:
  34. cmMakefile* Makefile;
  35. const char* Config;
  36. cmListFileBacktrace const& Backtrace;
  37. std::vector<char> Data;
  38. std::stack<size_t> Barriers;
  39. cmsys::RegularExpression TargetInfo;
  40. bool Evaluate();
  41. bool Evaluate(const char* expr, std::string& result);
  42. bool EvaluateTargetInfo(std::string& result);
  43. };