summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2012-09-18 11:53:39 (GMT)
committerBrad King <brad.king@kitware.com>2012-09-28 12:49:21 (GMT)
commiteb250cd18aaa5308eee12cf016bbfdd25a543da6 (patch)
tree253ffd8f32e0515430a8d059b1e7ded144ee11e8 /Source
parent7e807472d2b17d40c702ff91c7255eca04a64ebe (diff)
downloadCMake-eb250cd18aaa5308eee12cf016bbfdd25a543da6.zip
CMake-eb250cd18aaa5308eee12cf016bbfdd25a543da6.tar.gz
CMake-eb250cd18aaa5308eee12cf016bbfdd25a543da6.tar.bz2
Add a self-reference check for target properties.
Prevent constructs like: ... INCLUDE_DIRECTORIES "$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>" Indirect self-references (cycles) are also prevented here, but indirect generator expression references of any kind are not possible yet anyway.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGeneratorExpressionEvaluator.cxx17
1 files changed, 16 insertions, 1 deletions
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index a9e28c3..67bcc0b 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -14,6 +14,7 @@
#include "cmGeneratorExpressionEvaluator.h"
#include "cmGeneratorExpressionParser.h"
#include "cmGeneratorExpressionDAGChecker.h"
+#include "cmGeneratorExpression.h"
//----------------------------------------------------------------------------
static void reportError(cmGeneratorExpressionContext *context,
@@ -264,7 +265,8 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
std::string Evaluate(const std::vector<std::string> &parameters,
cmGeneratorExpressionContext *context,
const GeneratorExpressionContent *content,
- cmGeneratorExpressionDAGChecker *) const
+ cmGeneratorExpressionDAGChecker *dagCheckerParent
+ ) const
{
if (parameters.size() != 1 && parameters.size() != 2)
{
@@ -289,6 +291,19 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
}
propertyName = parameters.at(1);
}
+
+ cmGeneratorExpressionDAGChecker dagChecker(context->Backtrace,
+ target->GetName(),
+ propertyName,
+ content,
+ dagCheckerParent);
+
+ if (!dagChecker.check())
+ {
+ dagChecker.reportError(context, content->GetOriginalExpression());
+ return std::string();
+ }
+
const char *prop = target->GetProperty(propertyName.c_str());
return prop ? prop : "";
}