summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2012-12-10 10:33:23 (GMT)
committerStephen Kelly <steveire@gmail.com>2013-01-05 00:05:09 (GMT)
commitb0c8f73eb62c5651b4a039f95676cae310bcada9 (patch)
tree43cc7d8a2db894cea68d8b5300cf3ee210e1f1a2 /Tests
parent77475fe61d0a1bbd562228bf66d5043bd001cb48 (diff)
downloadCMake-b0c8f73eb62c5651b4a039f95676cae310bcada9.zip
CMake-b0c8f73eb62c5651b4a039f95676cae310bcada9.tar.gz
CMake-b0c8f73eb62c5651b4a039f95676cae310bcada9.tar.bz2
Add the TARGET_NAME generator expression.
It will be used as a preprocessing marker.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/GeneratorExpression/CMakeLists.txt2
-rw-r--r--Tests/GeneratorExpression/check-part2.cmake2
-rw-r--r--Tests/RunCMake/GeneratorExpression/BadTargetName-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorExpression/BadTargetName-stderr.txt8
-rw-r--r--Tests/RunCMake/GeneratorExpression/BadTargetName.cmake3
-rw-r--r--Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake1
6 files changed, 17 insertions, 0 deletions
diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt
index db6fb74..ecbbedf 100644
--- a/Tests/GeneratorExpression/CMakeLists.txt
+++ b/Tests/GeneratorExpression/CMakeLists.txt
@@ -87,6 +87,8 @@ add_custom_target(check-part2 ALL
-Dtest_incomplete_21=$<BOOL:something$<ANGLE-R>
-Dtest_build_interface=$<BUILD_INTERFACE:build>
-Dtest_install_interface=$<INSTALL_INTERFACE:install>
+ -Dtest_target_name_1=$<TARGET_NAME:tgt,ok>
+ -Dtest_target_name_2=$<TARGET_NAME:tgt:ok>
-P ${CMAKE_CURRENT_SOURCE_DIR}/check-part2.cmake
COMMAND ${CMAKE_COMMAND} -E echo "check done (part 2 of 2)"
VERBATIM
diff --git a/Tests/GeneratorExpression/check-part2.cmake b/Tests/GeneratorExpression/check-part2.cmake
index 149a658..8855a97 100644
--- a/Tests/GeneratorExpression/check-part2.cmake
+++ b/Tests/GeneratorExpression/check-part2.cmake
@@ -24,3 +24,5 @@ check(test_incomplete_20 "$<CONFIGURATION>")
check(test_incomplete_21 "$<BOOL:something>")
check(test_build_interface "build")
check(test_install_interface "")
+check(test_target_name_1 "tgt,ok")
+check(test_target_name_2 "tgt:ok")
diff --git a/Tests/RunCMake/GeneratorExpression/BadTargetName-result.txt b/Tests/RunCMake/GeneratorExpression/BadTargetName-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/BadTargetName-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorExpression/BadTargetName-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadTargetName-stderr.txt
new file mode 100644
index 0000000..969393a
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/BadTargetName-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at BadTargetName.cmake:1 \(add_custom_target\):
+ Error evaluating generator expression:
+
+ \$<TARGET_NAME:\$<1:tgt>>
+
+ \$<TARGET_NAME> expression requires literal input.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/GeneratorExpression/BadTargetName.cmake b/Tests/RunCMake/GeneratorExpression/BadTargetName.cmake
new file mode 100644
index 0000000..e125cab
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/BadTargetName.cmake
@@ -0,0 +1,3 @@
+add_custom_target(check ALL COMMAND check
+ $<TARGET_NAME:$<1:tgt>>
+ VERBATIM)
diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
index 992ba79..8a69675 100644
--- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
@@ -6,3 +6,4 @@ run_cmake(BadAND)
run_cmake(BadNOT)
run_cmake(BadStrEqual)
run_cmake(BadZero)
+run_cmake(BadTargetName)