summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmGeneratorExpressionEvaluator.cxx5
-rw-r--r--Tests/RunCMake/TargetPropertyGeneratorExpressions/BadNonTarget-result.txt1
-rw-r--r--Tests/RunCMake/TargetPropertyGeneratorExpressions/BadNonTarget-stderr.txt6
-rw-r--r--Tests/RunCMake/TargetPropertyGeneratorExpressions/BadNonTarget.cmake7
-rw-r--r--Tests/RunCMake/TargetPropertyGeneratorExpressions/RunCMakeTest.cmake1
5 files changed, 18 insertions, 2 deletions
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index ad5f83c..80cffe9 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -278,14 +278,15 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
std::string propertyName = *parameters.begin();
if (parameters.size() == 2)
{
+ std::string targetName = parameters.front();
target = context->Makefile->FindGeneratorTargetToUse(
- parameters.begin()->c_str());
+ targetName.c_str());
if (!target)
{
cmOStringStream e;
e << "Target \""
- << target
+ << targetName
<< "\" not found.";
reportError(context, content->GetOriginalExpression(), e.str());
return std::string();
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadNonTarget-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadNonTarget-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadNonTarget-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadNonTarget-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadNonTarget-stderr.txt
new file mode 100644
index 0000000..d2ac7a9
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadNonTarget-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error:
+ Error evaluating generator expression:
+
+ \$<TARGET_PROPERTY:NonExistant,INCLUDE_DIRECTORIES>
+
+ Target "NonExistant" not found.$
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadNonTarget.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadNonTarget.cmake
new file mode 100644
index 0000000..b020c08
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadNonTarget.cmake
@@ -0,0 +1,7 @@
+
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp"
+ "int main(int, char **) { return 0; }\n")
+
+add_executable(TargetPropertyGeneratorExpressions
+ "${CMAKE_CURRENT_BINARY_DIR}/main.cpp")
+include_directories("$<TARGET_PROPERTY:NonExistant,INCLUDE_DIRECTORIES>")
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/RunCMakeTest.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/RunCMakeTest.cmake
index f2ff05b..e2abd56 100644
--- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/RunCMakeTest.cmake
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/RunCMakeTest.cmake
@@ -6,3 +6,4 @@ run_cmake(BadSelfReference3)
run_cmake(BadSelfReference4)
run_cmake(BadSelfReference5)
run_cmake(BadSelfReference6)
+run_cmake(BadNonTarget)