diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-01-03 19:56:32 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2013-01-03 19:56:32 (GMT) |
commit | e767ffcda58ab73cf2c4394202eec7ae1f6035b5 (patch) | |
tree | bc8c6421d47c765440aa0bc911cf2462809e1c97 /Source/cmGeneratorExpressionEvaluator.cxx | |
parent | 2c4969a131fbdd949cac02520133b2c865b9fd78 (diff) | |
download | CMake-e767ffcda58ab73cf2c4394202eec7ae1f6035b5.zip CMake-e767ffcda58ab73cf2c4394202eec7ae1f6035b5.tar.gz CMake-e767ffcda58ab73cf2c4394202eec7ae1f6035b5.tar.bz2 |
Don't crash when a target is expected but is not available.
Diffstat (limited to 'Source/cmGeneratorExpressionEvaluator.cxx')
-rw-r--r-- | Source/cmGeneratorExpressionEvaluator.cxx | 15 |
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, |