I'm trying to create a simple batcher, which runs a script over a set of files.
So, after globbed files, I've created the following custom command to execute the script:
add_custom_command(OUTPUT ${RESOURCE_GFX} COMMAND ${EXE_GFX_EXPORT} ${GFX_EXPORT_PARAMETERS} ${RESOURCE_SWF})
where EXE_GFX_EXPORT
is the script program, something like C:\Program Files (x86)\Scaleform\GFx SDK 3.1\Bin\gfxexport.exe
; RESOURCE_SWF
is the file that the script runs on; and GFX_EXPORT_PARAMETERS
are script's parameters, something in the form of -i DDS -share_images -qp
.
CMake "translates" this custom command in:
"C:\Program Files (x86)\Scaleform\GFx SDK 3.1\Bin\gfxexport.exe" "-i DDS -share_images -qp" "C:\path\to\file.swf"
but gfxexport.exe
can't handle parameters surrounded by double quotes. Is there a way to avoid CMake automatically puts them around GFX_EXPORT_PARAMETERS
variable?
Thanks guys, Raffaele.
Try using the separate_arguments function on the parameter GFX_EXPORT_PARAMETERS
before invoking add_custom_command
:
separate_arguments(GFX_EXPORT_PARAMETERS_LIST WINDOWS_COMMAND "${GFX_EXPORT_PARAMETERS}")
add_custom_command(OUTPUT ${RESOURCE_GFX} COMMAND ${EXE_GFX_EXPORT} ${GFX_EXPORT_PARAMETERS_LIST} ${RESOURCE_SWF})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With