Ok, thanks for the info.
Can I expect this "IN" mode to be delivered in 2.6.5?

Alexandre

-----Original Message-----
From: Brad King [mailto:brad.k...@kitware.com] 


alexandre.feb...@thomsonreuters.com wrote:
> foreach(arg ${list})
[snip]
> The empty element has been discarded by foreach(). Is this the wanted 
> behaviour? If it is, how can I manage empty elements when I need them?

The foreach command never even sees the empty arguments.  By the time
${list} is evaluated the empty elements are gone.  This is for language
consistency.  No one would want

   add_executable(myexe ${srcs})

to try to add "" as a source file if srcs has an empty element.

In CMake HEAD from CVS there is an "IN" mode for foreach that supports
explicitly named lists:

   set(my_list "a;b;;c;d")
   foreach(arg IN LISTS my_list)
     ...
   endforeach()

For now you need to use the list() command.  You can iterate over
a range of the list size with foreach(arg RANGE ...).

-Brad


This email was sent to you by Thomson Reuters, the global news and information 
company.
Any views expressed in this message are those of the individual sender, except 
where the sender specifically states them to be the views of Thomson Reuters.


_______________________________________________
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

Reply via email to