[CMake] foreach() bug?

Denis Scherbakov denis_scherbakov at yahoo.com
Tue May 5 13:24:47 EDT 2009


The only solution I see is to use LIST(GET...
But you'll need to get LIST length somehow...

Denis


--- On Tue, 5/5/09, Alexandre.Feblot at thomsonreuters.com <Alexandre.Feblot at thomsonreuters.com> wrote:

> From: Alexandre.Feblot at thomsonreuters.com <Alexandre.Feblot at thomsonreuters.com>
> Subject: Re: [CMake] foreach() bug?
> To: cmake at cmake.org
> Date: Tuesday, May 5, 2009, 9:41 AM
> ping?
> 
> ________________________________
> 
> Hi,
> 
>  
> 
> this code:
> 
>  
> 
> list(APPEND list A B "" C D)
> 
> message("List: ${list}")
> 
> foreach(arg ${list})
> 
>     message("List elem: ${arg}")
> 
> endforeach()
> 
>  
> 
> has the following result:
> 
>  
> 
> List: A;B;;C;D
> 
> List elem: A
> 
> List elem: B
> 
> List elem: C
> 
> List elem: D
> 
>  
> 
> 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?
> 
>  
> 
> thanks
> 
> Alexandre  
> 
> 
> 
> 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


      


More information about the CMake mailing list