summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-01-07 19:19:47 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2013-01-07 19:19:47 (GMT)
commit34f959e5b11d3acbf352f20137aa17402ceb5f8e (patch)
tree90b4f1254b7c0b26b04edc9ec4a2f9bb5dafda93 /Source
parent0a097af097fbce43ecda6799db869585366604b7 (diff)
parente767ffcda58ab73cf2c4394202eec7ae1f6035b5 (diff)
downloadCMake-34f959e5b11d3acbf352f20137aa17402ceb5f8e.zip
CMake-34f959e5b11d3acbf352f20137aa17402ceb5f8e.tar.gz
CMake-34f959e5b11d3acbf352f20137aa17402ceb5f8e.tar.bz2
Merge topic 'fix-genex-with-no-target'
e767ffc Don't crash when a target is expected but is not available.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGeneratorExpressionEvaluator.cxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index 3b7cfc0..d86ae54 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -18,6 +18,8 @@
#include <cmsys/String.h>
+#include <assert.h>
+
//----------------------------------------------------------------------------
#if !defined(__SUNPRO_CC) || __SUNPRO_CC > 0x510
static
@@ -291,6 +293,17 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
cmTarget* target = context->Target;
std::string propertyName = *parameters.begin();
+
+ if (!target && parameters.size() == 1)
+ {
+ reportError(context, content->GetOriginalExpression(),
+ "$<TARGET_PROPERTY:prop> may only be used with targets. It may not "
+ "be used with add_custom_command. Specify the target to read a "
+ "property from using the $<TARGET_PROPERTY:tgt,prop> signature "
+ "instead.");
+ return std::string();
+ }
+
if (parameters.size() == 2)
{
if (parameters.begin()->empty() && parameters[1].empty())
@@ -351,6 +364,8 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
return std::string();
}
+ assert(target);
+
cmGeneratorExpressionDAGChecker dagChecker(context->Backtrace,
target->GetName(),
propertyName,