summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2012-10-09 12:40:07 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2012-10-09 12:40:07 (GMT)
commit53c2dada1c4019ed21f14f33618a975a9652c84e (patch)
tree8825785f886c8c679a41ae9a704b26459d6b04ba
parentfb4de4495dbdde59b5fb210f0cbb835ebf5d7a6a (diff)
parent7aa99270fa77a13e8e710adc0098385403d6cf7a (diff)
downloadCMake-53c2dada1c4019ed21f14f33618a975a9652c84e.zip
CMake-53c2dada1c4019ed21f14f33618a975a9652c84e.tar.gz
CMake-53c2dada1c4019ed21f14f33618a975a9652c84e.tar.bz2
Merge topic 'generator-expression-bug-fixes'
7aa9927 GenEx: Don't use std::vector::at(int). 78e54b9 GenEx: Add tests for "0" and "1" expressions with literal commas. d729e8b GenEx: Add test for $<BOOL:> with empty parameter. 354face GenEx: Ensure that the empty CONFIGURATION can be used conditionally. 8b3b88a GenEx: Validate target and property names. b3d8f5d GenEx: Parse comma after colon tokens specially a4985a9 GenEx: Report actual target name not found, not "0" each time. d70650d GenEx: Return after error reported. 4801eb6 GenEx: It is not an error to specify an empty parameter
-rw-r--r--Source/cmGeneratorExpressionEvaluator.cxx65
-rw-r--r--Source/cmGeneratorExpressionParser.cxx12
-rw-r--r--Tests/GeneratorExpression/CMakeLists.txt5
-rw-r--r--Tests/GeneratorExpression/check.cmake5
-rw-r--r--Tests/RunCMake/GeneratorExpression/BadNOT-stderr.txt2
-rw-r--r--Tests/RunCMake/GeneratorExpression/BadStrEqual-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorExpression/BadStrEqual-stderr.txt38
-rw-r--r--Tests/RunCMake/GeneratorExpression/BadStrEqual.cmake6
-rw-r--r--Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName1-result.txt1
-rw-r--r--Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName1-stderr.txt6
-rw-r--r--Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName1.cmake7
-rw-r--r--Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName2-result.txt1
-rw-r--r--Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName2-stderr.txt6
-rw-r--r--Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName2.cmake7
-rw-r--r--Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName3-result.txt1
-rw-r--r--Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName3-stderr.txt6
-rw-r--r--Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName3.cmake7
-rw-r--r--Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName4-result.txt1
-rw-r--r--Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName4-stderr.txt6
-rw-r--r--Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName4.cmake9
-rw-r--r--Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName5-result.txt1
-rw-r--r--Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName5-stderr.txt7
-rw-r--r--Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName5.cmake7
-rw-r--r--Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName6-result.txt1
-rw-r--r--Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName6-stderr.txt6
-rw-r--r--Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName6.cmake7
-rw-r--r--Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName7-result.txt1
-rw-r--r--Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName7-stderr.txt6
-rw-r--r--Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName7.cmake9
-rw-r--r--Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName8-result.txt1
-rw-r--r--Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName8-stderr.txt6
-rw-r--r--Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName8.cmake7
-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.cmake9
37 files changed, 260 insertions, 15 deletions
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index 22f60d4..92e2052 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -173,7 +173,7 @@ static const struct StrEqualNode : public cmGeneratorExpressionNode
const GeneratorExpressionContent *,
cmGeneratorExpressionDAGChecker *) const
{
- return *parameters.begin() == parameters.at(1) ? "1" : "0";
+ return *parameters.begin() == parameters[1] ? "1" : "0";
}
} strEqualNode;
@@ -237,11 +237,6 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode
const GeneratorExpressionContent *content,
cmGeneratorExpressionDAGChecker *) const
{
- if (!context->Config)
- {
- return std::string();
- }
-
cmsys::RegularExpression configValidator;
configValidator.compile("^[A-Za-z0-9_]*$");
if (!configValidator.find(parameters.begin()->c_str()))
@@ -250,6 +245,11 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode
"Expression syntax not recognized.");
return std::string();
}
+ if (!context->Config)
+ {
+ return parameters.front().empty() ? "1" : "0";
+ }
+
return *parameters.begin() == context->Config ? "1" : "0";
}
} configurationTestNode;
@@ -274,22 +274,69 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
"$<TARGET_PROPERTY:...> expression requires one or two parameters");
return std::string();
}
+ cmsys::RegularExpression nameValidator;
+ nameValidator.compile("^[A-Za-z0-9_.-]+$");
+
cmGeneratorTarget* target = context->Target;
std::string propertyName = *parameters.begin();
if (parameters.size() == 2)
{
+ if (parameters.begin()->empty() && parameters[1].empty())
+ {
+ reportError(context, content->GetOriginalExpression(),
+ "$<TARGET_PROPERTY:tgt,prop> expression requires a non-empty "
+ "target name and property name.");
+ return std::string();
+ }
+ if (parameters.begin()->empty())
+ {
+ reportError(context, content->GetOriginalExpression(),
+ "$<TARGET_PROPERTY:tgt,prop> expression requires a non-empty "
+ "target name.");
+ return std::string();
+ }
+
+ std::string targetName = parameters.front();
+ propertyName = parameters[1];
+ if (!nameValidator.find(targetName.c_str()))
+ {
+ if (!nameValidator.find(propertyName.c_str()))
+ {
+ ::reportError(context, content->GetOriginalExpression(),
+ "Target name and property name not supported.");
+ return std::string();
+ }
+ ::reportError(context, content->GetOriginalExpression(),
+ "Target name not supported.");
+ return std::string();
+ }
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();
}
- propertyName = parameters.at(1);
+ }
+
+ if (propertyName.empty())
+ {
+ reportError(context, content->GetOriginalExpression(),
+ "$<TARGET_PROPERTY:...> expression requires a non-empty property "
+ "name.");
+ return std::string();
+ }
+
+ if (!nameValidator.find(propertyName.c_str()))
+ {
+ ::reportError(context, content->GetOriginalExpression(),
+ "Property name not supported.");
+ return std::string();
}
cmGeneratorExpressionDAGChecker dagChecker(context->Backtrace,
diff --git a/Source/cmGeneratorExpressionParser.cxx b/Source/cmGeneratorExpressionParser.cxx
index d3c4aa3..d95e1cc 100644
--- a/Source/cmGeneratorExpressionParser.cxx
+++ b/Source/cmGeneratorExpressionParser.cxx
@@ -118,10 +118,16 @@ void cmGeneratorExpressionParser::ParseGeneratorExpression(
colonToken = this->it;
parameters.resize(parameters.size() + 1);
++this->it;
+ while (this->it->TokenType == cmGeneratorExpressionToken::CommaSeparator)
+ {
+ commaTokens.push_back(this->it);
+ parameters.resize(parameters.size() + 1);
+ ++this->it;
+ }
while(this->it->TokenType != cmGeneratorExpressionToken::EndExpression)
{
this->ParseContent(*(parameters.end() - 1));
- if (this->it->TokenType == cmGeneratorExpressionToken::CommaSeparator)
+ while (this->it->TokenType == cmGeneratorExpressionToken::CommaSeparator)
{
commaTokens.push_back(this->it);
parameters.resize(parameters.size() + 1);
@@ -142,10 +148,6 @@ void cmGeneratorExpressionParser::ParseGeneratorExpression(
--this->NestingLevel;
++this->it;
}
- if (parameters.empty())
- {
- // ERROR
- }
}
if (nestedLevel != this->NestingLevel)
diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt
index 79a8abb..8bc4f32 100644
--- a/Tests/GeneratorExpression/CMakeLists.txt
+++ b/Tests/GeneratorExpression/CMakeLists.txt
@@ -4,7 +4,9 @@ project(GeneratorExpression NONE)
add_custom_target(check ALL
COMMAND ${CMAKE_COMMAND}
-Dtest_0=$<0:nothing>
+ -Dtest_0_with_comma=$<0:-Wl,--no-undefined>
-Dtest_1=$<1:content>
+ -Dtest_1_with_comma=$<1:-Wl,--no-undefined>
-Dconfig=$<CONFIGURATION>
-Dtest_and_0=$<AND:0>
-Dtest_and_0_0=$<AND:0,0>
@@ -30,6 +32,7 @@ add_custom_target(check ALL
-Dtest_bool_off=$<BOOL:Off>
-Dtest_bool_no=$<BOOL:No>
-Dtest_bool_n=$<BOOL:N>
+ -Dtest_bool_empty=$<BOOL:>
-Dtest_strequal_yes_yes=$<STREQUAL:Yes,Yes>
-Dtest_strequal_yes_yes_cs=$<STREQUAL:Yes,yes>
-Dtest_strequal_yes_no=$<STREQUAL:Yes,No>
@@ -37,6 +40,8 @@ add_custom_target(check ALL
-Dtest_strequal_angle_r=$<STREQUAL:$<ANGLE-R>,$<ANGLE-R>>
-Dtest_strequal_comma=$<STREQUAL:$<COMMA>,$<COMMA>>
-Dtest_strequal_angle_r_comma=$<STREQUAL:$<ANGLE-R>,$<COMMA>>
+ -Dtest_strequal_both_empty=$<STREQUAL:,>
+ -Dtest_strequal_one_empty=$<STREQUAL:something,>
-Dtest_angle_r=$<ANGLE-R>
-Dtest_comma=$<COMMA>
-P ${CMAKE_CURRENT_SOURCE_DIR}/check.cmake
diff --git a/Tests/GeneratorExpression/check.cmake b/Tests/GeneratorExpression/check.cmake
index 6fb87a2..ec1f130 100644
--- a/Tests/GeneratorExpression/check.cmake
+++ b/Tests/GeneratorExpression/check.cmake
@@ -6,7 +6,9 @@ endmacro()
message(STATUS "config=[${config}]")
check(test_0 "")
+check(test_0_with_comma "")
check(test_1 "content")
+check(test_1_with_comma "-Wl,--no-undefined")
check(test_and_0 "0")
check(test_and_0_0 "0")
check(test_and_0_1 "0")
@@ -31,6 +33,7 @@ check(test_bool_on "1")
check(test_bool_off "0")
check(test_bool_no "0")
check(test_bool_n "0")
+check(test_bool_empty "0")
check(test_strequal_yes_yes "1")
check(test_strequal_yes_yes_cs "0")
check(test_strequal_yes_no "0")
@@ -38,5 +41,7 @@ check(test_strequal_no_yes "0")
check(test_strequal_angle_r "1")
check(test_strequal_comma "1")
check(test_strequal_angle_r_comma "0")
+check(test_strequal_both_empty "1")
+check(test_strequal_one_empty "0")
check(test_angle_r ">")
check(test_comma ",")
diff --git a/Tests/RunCMake/GeneratorExpression/BadNOT-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadNOT-stderr.txt
index 32169c5..e5e628c 100644
--- a/Tests/RunCMake/GeneratorExpression/BadNOT-stderr.txt
+++ b/Tests/RunCMake/GeneratorExpression/BadNOT-stderr.txt
@@ -20,7 +20,7 @@ CMake Error at BadNOT.cmake:1 \(add_custom_target\):
\$<NOT:,>
- \$<NOT> parameter must resolve to exactly one '0' or '1' value.
+ \$<NOT> expression requires exactly one parameter.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
+
diff --git a/Tests/RunCMake/GeneratorExpression/BadStrEqual-result.txt b/Tests/RunCMake/GeneratorExpression/BadStrEqual-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/BadStrEqual-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorExpression/BadStrEqual-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadStrEqual-stderr.txt
new file mode 100644
index 0000000..dd0d931
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/BadStrEqual-stderr.txt
@@ -0,0 +1,38 @@
+CMake Error at BadStrEqual.cmake:1 \(add_custom_target\):
+ Error evaluating generator expression:
+
+ \$<STREQUAL>
+
+ \$<STREQUAL> expression requires 2 comma separated parameters, but got 0
+ instead.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++CMake Error at BadStrEqual.cmake:1 \(add_custom_target\):
+ Error evaluating generator expression:
+
+ \$<STREQUAL:>
+
+ \$<STREQUAL> expression requires 2 comma separated parameters, but got 1
+ instead.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error at BadStrEqual.cmake:1 \(add_custom_target\):
+ Error evaluating generator expression:
+
+ \$<STREQUAL:,,>
+
+ \$<STREQUAL> expression requires 2 comma separated parameters, but got 3
+ instead.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error at BadStrEqual.cmake:1 \(add_custom_target\):
+ Error evaluating generator expression:
+
+ \$<STREQUAL:something,,>
+
+ \$<STREQUAL> expression requires 2 comma separated parameters, but got 3
+ instead.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/GeneratorExpression/BadStrEqual.cmake b/Tests/RunCMake/GeneratorExpression/BadStrEqual.cmake
new file mode 100644
index 0000000..56eb458
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/BadStrEqual.cmake
@@ -0,0 +1,6 @@
+add_custom_target(check ALL COMMAND check
+ $<STREQUAL>
+ $<STREQUAL:>
+ $<STREQUAL:,,>
+ $<STREQUAL:something,,>
+ VERBATIM)
diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
index ed18f25..18a47ae 100644
--- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
@@ -4,3 +4,4 @@ run_cmake(BadCONFIG)
run_cmake(BadOR)
run_cmake(BadAND)
run_cmake(BadNOT)
+run_cmake(BadStrEqual)
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName1-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName1-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName1-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName1-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName1-stderr.txt
new file mode 100644
index 0000000..3287d19
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName1-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error:
+ Error evaluating generator expression:
+
+ \$<TARGET_PROPERTY:Invali/dTarget,INCLUDE_DIRECTORIES>
+
+ Target name not supported.
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName1.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName1.cmake
new file mode 100644
index 0000000..d5f661d
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName1.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:Invali/dTarget,INCLUDE_DIRECTORIES>")
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName2-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName2-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName2-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName2-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName2-stderr.txt
new file mode 100644
index 0000000..e527e22
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName2-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error:
+ Error evaluating generator expression:
+
+ \$<TARGET_PROPERTY:Invali/dTarget,Invali/dProperty>
+
+ Target name and property name not supported.$
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName2.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName2.cmake
new file mode 100644
index 0000000..6e4c1d0
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName2.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:Invali/dTarget,Invali/dProperty>")
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName3-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName3-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName3-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName3-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName3-stderr.txt
new file mode 100644
index 0000000..517debb
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName3-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error:
+ Error evaluating generator expression:
+
+ \$<TARGET_PROPERTY:Invali/dProperty>
+
+ Property name not supported.$
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName3.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName3.cmake
new file mode 100644
index 0000000..3f75aa3
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName3.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:Invali/dProperty>")
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName4-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName4-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName4-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName4-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName4-stderr.txt
new file mode 100644
index 0000000..eab6fb6
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName4-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error:
+ Error evaluating generator expression:
+
+ \$<TARGET_PROPERTY:foo,Invali/dProperty>
+
+ Property name not supported.$
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName4.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName4.cmake
new file mode 100644
index 0000000..b616c31
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName4.cmake
@@ -0,0 +1,9 @@
+
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp"
+ "int main(int, char **) { return 0; }\n")
+
+add_executable(foo "${CMAKE_CURRENT_BINARY_DIR}/main.cpp")
+
+add_executable(TargetPropertyGeneratorExpressions
+ "${CMAKE_CURRENT_BINARY_DIR}/main.cpp")
+include_directories("$<TARGET_PROPERTY:foo,Invali/dProperty>")
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName5-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName5-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName5-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName5-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName5-stderr.txt
new file mode 100644
index 0000000..e2b4fc6
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName5-stderr.txt
@@ -0,0 +1,7 @@
+CMake Error:
+ Error evaluating generator expression:
+
+ \$<TARGET_PROPERTY:,>
+
+ \$<TARGET_PROPERTY:tgt,prop> expression requires a non-empty target name and
+ property name.
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName5.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName5.cmake
new file mode 100644
index 0000000..11cb6fa
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName5.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:,>")
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName6-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName6-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName6-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName6-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName6-stderr.txt
new file mode 100644
index 0000000..e94f52f
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName6-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error:
+ Error evaluating generator expression:
+
+ \$<TARGET_PROPERTY:,ValidProperty>
+
+ \$<TARGET_PROPERTY:tgt,prop> expression requires a non-empty target name.
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName6.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName6.cmake
new file mode 100644
index 0000000..bf868a5
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName6.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:,ValidProperty>")
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName7-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName7-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName7-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName7-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName7-stderr.txt
new file mode 100644
index 0000000..2548215
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName7-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error:
+ Error evaluating generator expression:
+
+ \$<TARGET_PROPERTY:foo,>
+
+ \$<TARGET_PROPERTY:...> expression requires a non-empty property name.
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName7.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName7.cmake
new file mode 100644
index 0000000..36d1a79
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName7.cmake
@@ -0,0 +1,9 @@
+
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp"
+ "int main(int, char **) { return 0; }\n")
+
+add_executable(foo "${CMAKE_CURRENT_BINARY_DIR}/main.cpp")
+
+add_executable(TargetPropertyGeneratorExpressions
+ "${CMAKE_CURRENT_BINARY_DIR}/main.cpp")
+include_directories("$<TARGET_PROPERTY:foo,>")
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName8-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName8-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName8-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName8-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName8-stderr.txt
new file mode 100644
index 0000000..2a98f6f
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName8-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error:
+ Error evaluating generator expression:
+
+ \$<TARGET_PROPERTY:>
+
+ \$<TARGET_PROPERTY:...> expression requires a non-empty property name.
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName8.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName8.cmake
new file mode 100644
index 0000000..f059288
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName8.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:>")
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..0ee3238 100644
--- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/RunCMakeTest.cmake
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/RunCMakeTest.cmake
@@ -6,3 +6,12 @@ run_cmake(BadSelfReference3)
run_cmake(BadSelfReference4)
run_cmake(BadSelfReference5)
run_cmake(BadSelfReference6)
+run_cmake(BadNonTarget)
+run_cmake(BadInvalidName1)
+run_cmake(BadInvalidName2)
+run_cmake(BadInvalidName3)
+run_cmake(BadInvalidName4)
+run_cmake(BadInvalidName5)
+run_cmake(BadInvalidName6)
+run_cmake(BadInvalidName7)
+run_cmake(BadInvalidName8)