diff options
author | Brad King <brad.king@kitware.com> | 2009-08-11 13:54:56 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-08-11 13:54:56 (GMT) |
commit | d2e1f2b4d6d87c171464b5dc41b00b609c90bf26 (patch) | |
tree | d0108fae5ed9b014939c0f7baee8a6ad4d6daa42 /Source/cmGeneratorExpression.h | |
parent | 463b3f03bd848a345ab535d31be31d395fe66b13 (diff) | |
download | CMake-d2e1f2b4d6d87c171464b5dc41b00b609c90bf26.zip CMake-d2e1f2b4d6d87c171464b5dc41b00b609c90bf26.tar.gz CMake-d2e1f2b4d6d87c171464b5dc41b00b609c90bf26.tar.bz2 |
Introduce "generator expressions" to add_test()
This introduces a new syntax called "generator expressions" to the test
COMMAND option of the add_test(NAME) command mode. These expressions
have a syntax like $<TARGET_FILE:mytarget> and are evaluated during
build system generation. This syntax allows per-configuration target
output files to be referenced in test commands and arguments.
Diffstat (limited to 'Source/cmGeneratorExpression.h')
-rw-r--r-- | Source/cmGeneratorExpression.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h new file mode 100644 index 0000000..05a697f --- /dev/null +++ b/Source/cmGeneratorExpression.h @@ -0,0 +1,55 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ +#include "cmStandardIncludes.h" + +#include <stack> + +#include <cmsys/RegularExpression.hxx> + +class cmMakefile; +class cmListFileBacktrace; + +/** \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 not available at configure time. + */ +class cmGeneratorExpression +{ +public: + /** Construct with an evaluation context and configuration. */ + cmGeneratorExpression(cmMakefile* mf, const char* config, + cmListFileBacktrace const& backtrace); + + /** Evaluate generator expressions in a string. */ + const char* Process(std::string const& input); + const char* Process(const char* input); +private: + cmMakefile* Makefile; + const char* Config; + cmListFileBacktrace const& Backtrace; + std::vector<char> Data; + std::stack<size_t> Barriers; + cmsys::RegularExpression TargetInfo; + bool Evaluate(); + bool Evaluate(const char* expr, std::string& result); + bool EvaluateTargetInfo(std::string& result); +}; |