summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/add_custom_target
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-05-14 15:49:02 (GMT)
committerBrad King <brad.king@kitware.com>2018-05-14 15:54:27 (GMT)
commit6e594916592e5f8f17b387546d79e484ac092b9e (patch)
treee063592913180cd287c58e92ad1795fd734bc74c /Tests/RunCMake/add_custom_target
parentfbe6cd1596bf280edd49aeb8f981f99d7cd8beb3 (diff)
downloadCMake-6e594916592e5f8f17b387546d79e484ac092b9e.zip
CMake-6e594916592e5f8f17b387546d79e484ac092b9e.tar.gz
CMake-6e594916592e5f8f17b387546d79e484ac092b9e.tar.bz2
add_custom_{command,target}: Fix crash on empty expanded command
Our custom command generation logic assumes that all command lines have at least `argv0`. In `add_custom_{command,target}` we already check that at least a `COMMAND` was given, but using `COMMAND_EXPAND_LISTS` in combination with a generator expression that expands to an empty string may produce an empty command line. In this case simply add an empty string as a command to maintain our internal invariant. Fixes: #17993
Diffstat (limited to 'Tests/RunCMake/add_custom_target')
-rw-r--r--Tests/RunCMake/add_custom_target/CommandExpandsEmpty.cmake1
-rw-r--r--Tests/RunCMake/add_custom_target/RunCMakeTest.cmake1
2 files changed, 2 insertions, 0 deletions
diff --git a/Tests/RunCMake/add_custom_target/CommandExpandsEmpty.cmake b/Tests/RunCMake/add_custom_target/CommandExpandsEmpty.cmake
new file mode 100644
index 0000000..bc899a4
--- /dev/null
+++ b/Tests/RunCMake/add_custom_target/CommandExpandsEmpty.cmake
@@ -0,0 +1 @@
+add_custom_target(EmptyCustom COMMAND "" COMMAND_EXPAND_LISTS)
diff --git a/Tests/RunCMake/add_custom_target/RunCMakeTest.cmake b/Tests/RunCMake/add_custom_target/RunCMakeTest.cmake
index 6c4e91b..2caed03 100644
--- a/Tests/RunCMake/add_custom_target/RunCMakeTest.cmake
+++ b/Tests/RunCMake/add_custom_target/RunCMakeTest.cmake
@@ -1,5 +1,6 @@
include(RunCMake)
+run_cmake(CommandExpandsEmpty)
run_cmake(NoArguments)
run_cmake(BadTargetName)
run_cmake(ByproductsNoCommand)