[CMake] Question about sending a macro a list of items

alaterale at elitemail.org alaterale at elitemail.org
Thu Jul 28 13:18:19 EDT 2005


Hi again,

I have a quick question about the use of MACRO that I need answered.  I
want to be able to send a list of names to a MACRO that I made so I can
use that list in a FOREACH statement or in other statements.  How do I
do this?  It only seems to receive the first item in the list.

SET(ITEMS item1 item2 item3 item4)

MACRO(print itemlist)
    MESSAGE("${itemlist}")
    FOREACH(item ${itemlist})
       MESSAGE("${item}")
    ENDFOREACH(item)
ENDMACRO(print)
print(${ITEMS})

I would expect to see item1;item2;item3... and then a vertical list of
the same names.  But I only ever see the first item in the list.  Can
anyone help me?  I didn't notice that this was happening until much
later than when I wrote the code and I need to be able to do this.

Thanks a lot!
~JS


More information about the CMake mailing list