But this does not work because CMake escapes whitespace between flags. The obvious alternative would be getting rid of the quotes around the generator expression but that causes it to not be expanded at all in build.ninja (or similar)!
Is there really no way to achieve this without “manual” string operations?
There is an example showing precisely this in the genex documentation. The example builds it up in several steps, but here are the two final forms it offers:
Using $<JOIN>:
# The $<BOOL:...> check prevents adding anything if the property is empty,
# assuming the property value cannot be one of CMake's false constants.
set(prop "$<TARGET_PROPERTY:tgt,INCLUDE_DIRECTORIES>")
add_custom_target(run_some_tool
COMMAND some_tool "$<$<BOOL:${prop}>:-I$<JOIN:${prop},;-I>>"
COMMAND_EXPAND_LISTS
VERBATIM
)