Empty add_custom_command not pruned by Ninja Generator
Reproduced as follows:
project(emptygenerator)
add_executable(dummy dummy.cpp)
add_custom_command(TARGET dummy POST_BUILD COMMAND $<0:date>)
The add_custom_command documentation indicates that empty COMMANDs are removed by the multi-configuration Visual Studio generator. The behaviour of the Makefile and Ninja generators is however not consistent:
$ make
Scanning dependencies of target dummy
[ 50%] Building CXX object CMakeFiles/dummy.dir/dummy.o
[100%] Linking CXX executable dummy
[100%] Built target dummy
$ ninja
[2/2] Linking CXX executable dummy
FAILED: dummy
: && /usr/bin/c++ -rdynamic CMakeFiles/dummy.dir/dummy.o -o dummy && cd /data/cmake/generator_fail/test && ""
/bin/sh: : command not found
ninja: build stopped: subcommand failed.
Edited by Daniel Evans