summaryrefslogtreecommitdiffstats
path: root/Tests/CustomCommand
diff options
context:
space:
mode:
authorGlenn Coombs <glenn.coombs@gmail.com>2024-05-13 04:09:19 (GMT)
committerBrad King <brad.king@kitware.com>2024-05-15 17:27:46 (GMT)
commit8d2a503c1e65142732ca78d3df60dce9a929dee2 (patch)
tree19f1b9e880f978d1cec94ddcb327eb2338768bc2 /Tests/CustomCommand
parentb38000d77427e64da55527284f0d397749560890 (diff)
downloadCMake-8d2a503c1e65142732ca78d3df60dce9a929dee2.zip
CMake-8d2a503c1e65142732ca78d3df60dce9a929dee2.tar.gz
CMake-8d2a503c1e65142732ca78d3df60dce9a929dee2.tar.bz2
add_custom_command: Allow OUTPUT filenames containing a hash '#' character
Most generators now support this character after escaping and quoting cleanups over time. Disallow it only on generators that do support it. Fixes: #25604
Diffstat (limited to 'Tests/CustomCommand')
-rw-r--r--Tests/CustomCommand/CMakeLists.txt9
1 files changed, 9 insertions, 0 deletions
diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt
index d46ee08..c145907 100644
--- a/Tests/CustomCommand/CMakeLists.txt
+++ b/Tests/CustomCommand/CMakeLists.txt
@@ -588,3 +588,12 @@ add_custom_target(drive_mac_fw ALL DEPENDS mac_fw.txt)
# Test empty COMMANDs are omitted
add_executable(empty_command empty_command.cxx)
add_custom_command(TARGET empty_command POST_BUILD COMMAND $<0:date>)
+
+# Test OUTPUT allows filenames containing "#" on generators that support this
+if(NOT CMAKE_GENERATOR MATCHES "Borland Makefiles")
+ add_custom_target(file_with_hash ALL DEPENDS "${PROJECT_BINARY_DIR}/hash#in#name.txt")
+ add_custom_command(
+ OUTPUT "${PROJECT_BINARY_DIR}/hash#in#name.txt"
+ COMMAND ${CMAKE_COMMAND} -E touch "${PROJECT_BINARY_DIR}/hash#in#name.txt"
+ )
+endif()