2009-09-28 19:43:28 +04:00
|
|
|
/*============================================================================
|
|
|
|
CMake - Cross Platform Makefile Generator
|
|
|
|
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
|
2009-08-11 17:54:56 +04:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
see accompanying file Copyright.txt for details.
|
2009-08-11 17:54:56 +04:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the License for more information.
|
|
|
|
============================================================================*/
|
2012-09-20 02:18:23 +04:00
|
|
|
|
|
|
|
#ifndef cmGeneratorExpression_h
|
|
|
|
#define cmGeneratorExpression_h
|
|
|
|
|
2009-08-11 17:54:56 +04:00
|
|
|
#include "cmStandardIncludes.h"
|
|
|
|
|
|
|
|
#include <stack>
|
|
|
|
|
|
|
|
#include <cmsys/RegularExpression.hxx>
|
|
|
|
|
2010-12-08 21:34:05 +03:00
|
|
|
class cmTarget;
|
2009-08-11 17:54:56 +04:00
|
|
|
class cmMakefile;
|
|
|
|
class cmListFileBacktrace;
|
|
|
|
|
2012-09-11 21:53:38 +04:00
|
|
|
struct cmGeneratorExpressionEvaluator;
|
2012-09-18 15:42:23 +04:00
|
|
|
struct cmGeneratorExpressionDAGChecker;
|
2012-09-11 21:53:38 +04:00
|
|
|
|
2012-09-12 17:11:25 +04:00
|
|
|
class cmCompiledGeneratorExpression;
|
|
|
|
|
2009-08-11 17:54:56 +04:00
|
|
|
/** \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:
|
2012-09-12 17:11:25 +04:00
|
|
|
/** Construct. */
|
|
|
|
cmGeneratorExpression(cmListFileBacktrace const& backtrace);
|
2012-09-11 21:53:38 +04:00
|
|
|
~cmGeneratorExpression();
|
|
|
|
|
2012-09-12 17:11:25 +04:00
|
|
|
const cmCompiledGeneratorExpression& Parse(std::string const& input);
|
|
|
|
const cmCompiledGeneratorExpression& Parse(const char* input);
|
|
|
|
|
2012-10-15 12:27:42 +04:00
|
|
|
enum PreprocessContext {
|
|
|
|
StripAllGeneratorExpressions
|
|
|
|
};
|
|
|
|
|
|
|
|
static std::string Preprocess(const std::string &input,
|
|
|
|
PreprocessContext context);
|
|
|
|
|
2012-09-12 17:11:25 +04:00
|
|
|
private:
|
|
|
|
cmGeneratorExpression(const cmGeneratorExpression &);
|
|
|
|
void operator=(const cmGeneratorExpression &);
|
|
|
|
|
|
|
|
cmListFileBacktrace const& Backtrace;
|
|
|
|
cmCompiledGeneratorExpression *CompiledExpression;
|
|
|
|
};
|
2010-12-08 21:34:05 +03:00
|
|
|
|
2012-09-12 17:11:25 +04:00
|
|
|
class cmCompiledGeneratorExpression
|
|
|
|
{
|
|
|
|
public:
|
2012-09-11 21:53:38 +04:00
|
|
|
const char* Evaluate(cmMakefile* mf, const char* config,
|
2012-09-12 06:23:31 +04:00
|
|
|
bool quiet = false,
|
2012-10-27 18:16:17 +04:00
|
|
|
cmTarget *target = 0,
|
2012-09-18 15:42:23 +04:00
|
|
|
cmGeneratorExpressionDAGChecker *dagChecker = 0) const;
|
2012-09-11 21:53:38 +04:00
|
|
|
|
2010-12-08 21:34:05 +03:00
|
|
|
/** Get set of targets found during evaluations. */
|
|
|
|
std::set<cmTarget*> const& GetTargets() const
|
|
|
|
{ return this->Targets; }
|
2012-09-12 17:11:25 +04:00
|
|
|
|
|
|
|
~cmCompiledGeneratorExpression();
|
|
|
|
|
2009-08-11 17:54:56 +04:00
|
|
|
private:
|
2012-09-12 17:11:25 +04:00
|
|
|
cmCompiledGeneratorExpression(cmListFileBacktrace const& backtrace,
|
|
|
|
const std::vector<cmGeneratorExpressionEvaluator*> &evaluators,
|
|
|
|
const char *input, bool needsParsing);
|
2012-09-11 21:53:38 +04:00
|
|
|
|
2012-09-12 17:11:25 +04:00
|
|
|
friend class cmGeneratorExpression;
|
|
|
|
|
|
|
|
cmCompiledGeneratorExpression(const cmCompiledGeneratorExpression &);
|
|
|
|
void operator=(const cmCompiledGeneratorExpression &);
|
|
|
|
|
|
|
|
cmListFileBacktrace const& Backtrace;
|
|
|
|
const std::vector<cmGeneratorExpressionEvaluator*> Evaluators;
|
|
|
|
const char* const Input;
|
|
|
|
const bool NeedsParsing;
|
2012-09-11 21:53:38 +04:00
|
|
|
|
2012-09-12 17:11:25 +04:00
|
|
|
mutable std::set<cmTarget*> Targets;
|
|
|
|
mutable std::string Output;
|
2009-08-11 17:54:56 +04:00
|
|
|
};
|
2012-09-20 02:18:23 +04:00
|
|
|
|
|
|
|
#endif
|