You can try COMMAND_EXPAND_LISTS in the add_custom_command command, it was introduced in CMake 3.8 and will expand the lists in the COMMAND argument.
COMMAND_EXPAND_LISTS
add_custom_command
COMMAND