[CMake] foreach et lists

Maxime Lecourt maxime.lecourt at gmail.com
Wed Jun 22 10:37:48 EDT 2011


The old syntax works, and I renamed file as f (good point).

Thank you.



2011/6/22 Michael Wild <themiwi at gmail.com>

> On 06/22/2011 04:11 PM, Maxime Lecourt wrote:
> > Hello,
> >
> > I'm using CMake to do some OCaml building.
> >
> > I launch the build command, using add_custom_command, so for the build
> > to actually trigger, I added the add_custom_target command.
> >
> > Which I thought I did fine :
> >
> > MACRO(OCAML_OPT LIST_OF_FILES)
> >     message(STATUS ${LIST_OF_FILES})
> >     FOREACH(FILE IN LISTS ${LIST_OF_FILES})
>
>       foreach(F IN LISTS LIST_OF_FILES)
>
> i.e. you pass the *name* of the list, not the elements. Otherwise, use
> the old syntax
>
>      foreach(F ${LIST_OF_FILES})
>
> Also, try not to use built-in variables or command names for your own
> variable names.
>
>
> Michael
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110622/41b2ebf4/attachment.htm>


More information about the CMake mailing list