I have created a pretty clean solution to this until there is native support for multi-dimensional arrays in CMake. I have attached the module, hopefully it will prove useful to others. Here is an example of how to use it:<div>
<br></div><div><div>set( two_dee_array</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>apple<span class="Apple-tab-span" style="white-space:pre">                        </span>cat</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>orange<span class="Apple-tab-span" style="white-space:pre">                </span>dog</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>banana<span class="Apple-tab-span" style="white-space:pre">                </span>elephant</div><div>)</div><div><br></div><div>array2d_begin_loop( advanced "${two_dee_array}" 2 "fruit;animal" )</div>
<div>while( advanced )</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>message( "Fruit: ${fruit}" )</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>message( "Animal: ${animal}" )</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>array2d_advance()</div><div>endwhile()</div><div><br></div><div>---------</div>Robert Dailey<br>
<br><br><div class="gmail_quote">On Mon, Nov 28, 2011 at 2:31 PM, Robert Dailey <span dir="ltr"><<a href="mailto:rcdailey@gmail.com">rcdailey@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Is it possible to have 2D arrays in CMake? As far as the core syntax is concerned, it seems like only 1D arrays are supported. So far I've had to work around this issue by using a flat array and skipping over elements using foreach() with a range and step.<div>
<br></div><div>Any ideas? Thanks.<br clear="all"><div><br></div><div>---------</div><span class="HOEnZb"><font color="#888888">Robert Dailey<br>
</font></span></div>
</blockquote></div><br></div>