[CMake] add_custom_command using CMAKE_CXX_FLAGS

Tyler Roscoe tyler at cryptio.net
Tue Aug 25 13:26:16 EDT 2009


Michael and Marcel have already posted helpful follow-ups to the
original question about compiling assembler files.

On Mon, Aug 24, 2009 at 01:38:13PM -0400, John Smith wrote:
> Most surely I am over-thinking it. After more local testing I think I  
> understand how variables are processed in the generation of commands.  
> I started from the command include_directories which actually builds a  
> *list* of tokens, each an include directory to be used in (a) makefile  
> rule. I noticed that using such a list as ARGS to ADD_CUSTOM_COMMAND  
> results in the splitting of the list in separate tokens, i.e.:
> 
> set(FOO a b c)
> ADD_CUSTOM_COMMAND(...
>   ARGS ${FOO}
>   ...)
> 
> ends up in a rule like:
> 
> <CMD> a b c ...
> 
> However, strings set up as:
> 
> set (FOO "a b c")
> 
> end up in the rule as:
> 
> <CMD> a\ b\ c ...
> 
> Therefore, I conclude that ARGS require lists, not strings of  
> concatenated, space-separated options. Am I right in this?

You've got the general idea but this may help with specifics:

http://www.cmake.org/Wiki/CMake/Language_Syntax

Also, take a look at the VERBATIM flag for add_custom_command().

tyler


More information about the CMake mailing list