I've a company internal tool which takes multiple files per command line using the following pattern
-i file1 -i file2
To add this tool to my CMake build I've been using the add_custom_target command like this
add_custom_target(
CustomTarget
COMMAND ${CompanyTool} ${FILES} -o output"
DEPENDS ActualTarget)
This works fine as long as FILES only expands to a single one but when I pass in multiple files the command starts to produce only garbage output. Upon inspecting the build.ninja files generated by CMake I found that the custom_target command gets translated to a call where the arguments are followed by backslashes like this
\ -i\ file\
I suspect that's the reason that this ain't working.
Now why the F. does CMake do this and how do I get rid of this behavior?
/edit
Printing the FILES string right before passing it to add_custom_target I can't see those backslashes...
Ok, got it. Building a new list and appending -i and file in a foreach looped worked.