[CMake] Passing multiple arguments to add_custom_command

Iman Brouwer iman.brouwer at gmail.com
Wed Jun 3 09:21:12 EDT 2009


Thanks Tyler, that works indeed. It seems very obvious now actually. For
people reading this thread in the archive, the following works:

SET( sources s1.cpp s2.cpp s3.cpp )
SET( arguments -c1 2 )
LIST( APPEND arguments ${sources} )
ADD_CUSTOM_COMMAND( TARGET test
                                           PRE_BUILD
                                           COMMAND "../test.py" ${arguments}
)

Iman

On Mon, Jun 1, 2009 at 4:47 PM, Tyler Roscoe <tyler at cryptio.net> wrote:

> On Mon, Jun 01, 2009 at 04:31:33PM -0400, Iman Brouwer wrote:
> > #Add the source files
> > FOREACH( cpp ${sources } )
> >     SET( arguments "${arguments} ${cpp}" )
> > ENDFOREACH( cpp )
> > add_custom_command( TARGET test COMMAND "script.py" "${arguments}" )
>
> I think that will work if you get rid of the "" around ${arguments}.
>
> You also might want to look at the VERBATIM parameter to
> add_custom_command().
>
> tyler
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090603/038cc694/attachment.htm>


More information about the CMake mailing list