[email protected] 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
_______________________________________________
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