add_custom_target and execute_process handle empty string differently
The CMake commands add_custom_target and execute_process have similar purpose: to run a given shell command. The difference between the two is whether the shell command is to be run at configure or at compile time. In both cases, the shell command is to be provided as a named COMMAND
argument to the CMake command.
Given this similarity in semantics and syntax, it would be nice if the COMMAND
argument were processed in exactly the same way for both CMake commands. Unfortunately, this is not the case. A bug hunt made me discover that empty strings are handled differently, as experimentation with something like
add_custom_target(ech COMMAND echo A "" B)
execute_process(COMMAND echo A "" B)
and variations like \"\"
will easily confirm.
It would be nice if these differences could be eliminated. To maintain backward compatibility, it might be necessary to create a new policy. If this is not possible, then at least the differences between the two CMake commands' COMMAND handling should be documented in their respective doc pages.