[CMake] Disable generation of backslashes?

Brad King brad.king at kitware.com
Mon Aug 15 18:54:55 EDT 2005


alaterale at elitemail.org wrote:
> Here's an excerpt from the code that is most directly responsible:
[snip]
> 	ADD_CUSTOM_COMMAND(TARGET ${target}
> 		COMMAND ${SDK_COMMAND_CC}
> 		ARGS
> 			"-S" "${cflags}" "$(INCLUDE_FLAGS)"
> 

This code is telling CMake that the custom command should pass the 
string resulting from evaluating "${cflags}" as a single argument on the 
command line.  CMake is therefore generating the escaped spaces to 
accomplish this.  You want the arguments to be passed separately though, 
so try this:

SET(SDK_COMMAND_CC_FLAGS "${cflags}")
SEPARATE_ARGUMENTS(SDK_COMMAND_CC_FLAGS)

ADD_CUSTOM_COMMAND(
   TARGET ${target}
   COMMAND ${SDK_COMMAND_CC}
   ARGS -S ${SDK_COMMAND_CC_FLAGS}
   ...
)

-Brad


More information about the CMake mailing list