summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorExpression.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-02-22 20:30:44 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-03-10 20:19:38 (GMT)
commit80b9f0cbe263c64613acd18e4e94505924fce40e (patch)
treeb54a4cb9c11baf6fa0f0b4bd6e425ab2a6c98d0d /Source/cmGeneratorExpression.cxx
parent642048ce356304155bf67b85deeacb9d030c3300 (diff)
downloadCMake-80b9f0cbe263c64613acd18e4e94505924fce40e.zip
CMake-80b9f0cbe263c64613acd18e4e94505924fce40e.tar.gz
CMake-80b9f0cbe263c64613acd18e4e94505924fce40e.tar.bz2
Genex: Extract an evaluateWithContext method.
Make it easier to make modifications to the context before evaluating with it.
Diffstat (limited to 'Source/cmGeneratorExpression.cxx')
-rw-r--r--Source/cmGeneratorExpression.cxx32
1 files changed, 20 insertions, 12 deletions
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index 0a27016..a4990dc 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -72,18 +72,6 @@ const char *cmCompiledGeneratorExpression::Evaluate(
cmGeneratorExpressionDAGChecker *dagChecker,
std::string const& language) const
{
- if (!this->NeedsEvaluation)
- {
- return this->Input.c_str();
- }
-
- this->Output = "";
-
- std::vector<cmGeneratorExpressionEvaluator*>::const_iterator it
- = this->Evaluators.begin();
- const std::vector<cmGeneratorExpressionEvaluator*>::const_iterator end
- = this->Evaluators.end();
-
cmGeneratorExpressionContext context;
context.Makefile = mf;
context.Config = config;
@@ -98,6 +86,26 @@ const char *cmCompiledGeneratorExpression::Evaluate(
context.Backtrace = this->Backtrace;
context.Language = language;
+ return this->EvaluateWithContext(context, dagChecker);
+}
+
+//----------------------------------------------------------------------------
+const char* cmCompiledGeneratorExpression::EvaluateWithContext(
+ cmGeneratorExpressionContext& context,
+ cmGeneratorExpressionDAGChecker *dagChecker) const
+{
+ if (!this->NeedsEvaluation)
+ {
+ return this->Input.c_str();
+ }
+
+ this->Output = "";
+
+ std::vector<cmGeneratorExpressionEvaluator*>::const_iterator it
+ = this->Evaluators.begin();
+ const std::vector<cmGeneratorExpressionEvaluator*>::const_iterator end
+ = this->Evaluators.end();
+
for ( ; it != end; ++it)
{
this->Output += (*it)->Evaluate(&context, dagChecker);