summaryrefslogtreecommitdiffstats
path: root/Tests/CustomCommand/CMakeLists.txt
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2009-09-25 17:23:19 (GMT)
committerDavid Cole <david.cole@kitware.com>2009-09-25 17:23:19 (GMT)
commitf199385605b228d73060f87647922fbe4c17779c (patch)
tree8340674f36f19b94adb837b781e295300274776d /Tests/CustomCommand/CMakeLists.txt
parent9c626d8f68b6ec35204c79e936e16a7a7d7471d0 (diff)
downloadCMake-f199385605b228d73060f87647922fbe4c17779c.zip
CMake-f199385605b228d73060f87647922fbe4c17779c.tar.gz
CMake-f199385605b228d73060f87647922fbe4c17779c.tar.bz2
Fix CMake Internal Error from cmTarget::GetOutputInfo - triggered by calling GetLocation on a utility target - caused by custom command output file with same name as custom target. The fix is to avoid calling GetLocation unless the target is of a type that is expected to have a location...
Diffstat (limited to 'Tests/CustomCommand/CMakeLists.txt')
-rw-r--r--Tests/CustomCommand/CMakeLists.txt27
1 files changed, 27 insertions, 0 deletions
diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt
index f76bbd5..664b507 100644
--- a/Tests/CustomCommand/CMakeLists.txt
+++ b/Tests/CustomCommand/CMakeLists.txt
@@ -386,3 +386,30 @@ ADD_CUSTOM_TARGET(pre_check_command_line
COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_CURRENT_BINARY_DIR}/check_mark.txt
)
ADD_DEPENDENCIES(do_check_command_line pre_check_command_line)
+
+# <SameNameTest>
+#
+# Add a custom target called "SameName" -- then add a custom command in a
+# different target whose output is a full-path file called "SameName" -- then
+# add a second custom target that depends on the full-path file ".../SameName"
+#
+# At first, this reproduces a bug reported by a customer. After fixing it,
+# having this test here makes sure it stays fixed moving forward.
+#
+ADD_CUSTOM_COMMAND(
+ OUTPUT SameName1.txt
+ COMMAND ${CMAKE_COMMAND} -E touch SameName1.txt
+ )
+ADD_CUSTOM_TARGET(SameName ALL
+ DEPENDS SameName1.txt
+ )
+
+ADD_CUSTOM_COMMAND(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/subdir/SameName
+ COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/subdir/SameName
+ )
+ADD_CUSTOM_TARGET(DifferentName ALL
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/subdir/SameName
+ )
+#
+# </SameNameTest>