Files
CMake/Source/cmGeneratorExpression.h
Stephen Kelly 1b9e168621 Avoid use of cmGeneratorExpressionEvaluator after deletion.
Disallow copying of the objects so that they can only be deleted one
time, at destruction of the cmGeneratorExpression.

Hopefully this fixes the Windows builds.
2012-09-13 18:30:48 +02:00

86 lines
2.7 KiB
C++

/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
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.
============================================================================*/
#include "cmStandardIncludes.h"
#include <stack>
#include <cmsys/RegularExpression.hxx>
class cmTarget;
class cmMakefile;
class cmListFileBacktrace;
class cmGeneratorExpressionEvaluator;
class cmCompiledGeneratorExpression;
/** \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. */
cmGeneratorExpression(cmListFileBacktrace const& backtrace);
~cmGeneratorExpression();
const cmCompiledGeneratorExpression& Parse(std::string const& input);
const cmCompiledGeneratorExpression& Parse(const char* input);
private:
cmListFileBacktrace const& Backtrace;
private:
cmGeneratorExpression(const cmGeneratorExpression &);
void operator=(const cmGeneratorExpression &);
cmCompiledGeneratorExpression *CompiledExpression;
};
class cmCompiledGeneratorExpression
{
public:
const char* Evaluate(cmMakefile* mf, const char* config,
bool quiet = false) const;
/** Get set of targets found during evaluations. */
std::set<cmTarget*> const& GetTargets() const
{ return this->Targets; }
~cmCompiledGeneratorExpression();
private:
cmCompiledGeneratorExpression(cmListFileBacktrace const& backtrace,
std::vector<cmGeneratorExpressionEvaluator*> evaluators,
const char *input, bool needsParsing);
friend class cmGeneratorExpression;
private:
const std::vector<cmGeneratorExpressionEvaluator*> Evaluators;
cmListFileBacktrace const& Backtrace;
mutable std::set<cmTarget*> Targets;
const char* const Input;
const bool NeedsParsing;
mutable std::string Output;
private:
cmCompiledGeneratorExpression(const cmCompiledGeneratorExpression &);
void operator=(const cmCompiledGeneratorExpression &);
};