I&#39;m running into this again, and I trawled through the mailing list, and according to Bill (4/11/2009 - managing lists with space separated elements), I should be able to get a list from a string with a single command.<div>

<br></div><div><font face="courier new, monospace"><span style="background-color:rgb(255,242,204)"><span style="font-size:13px">If you want to </span><span class="" style="font-size:13px">convert</span><span style="font-size:13px"> a string to a </span><span class="" style="font-size:13px">list</span><span style="font-size:13px"> you can do it like this:</span><br style="font-size:13px">

<br style="font-size:13px"><span style="font-size:13px">set(</span><span class="" style="font-size:13px">list</span><span style="font-size:13px"> ${string})</span><br style="font-size:13px"><br style="font-size:13px"><span style="font-size:13px">That will make the space separated </span><span class="" style="font-size:13px">list</span><span style="font-size:13px"> string into a ; separated </span><span class="" style="font-size:13px">list</span><span style="font-size:13px">.  If you want to keep string a string you need quotes:</span><br style="font-size:13px">

<span style="font-size:13px">set(newstring &quot;${string}&quot;).</span></span><br style="font-size:13px"></font></div><div><br></div><div>It doesn&#39;t seem to work that way though, so perhaps I&#39;m missing something.</div>

<div><br></div><div>Here&#39;s my test program:</div><div><br></div><div><div><font face="courier new, monospace">function(print_list name)</font></div><div><font face="courier new, monospace">  list(LENGTH ${name} length_of_list)</font></div>

<div><font face="courier new, monospace">  message(&quot;${name} has ${length_of_list} items&quot;)</font></div><div><font face="courier new, monospace">  set(count 0)</font></div><div><font face="courier new, monospace">  foreach(i ${${name}})</font></div>

<div><font face="courier new, monospace">    message(&quot;${name}[${count}] = ${i}&quot;)</font></div><div><font face="courier new, monospace">    math(EXPR count &quot;${count} + 1&quot;)</font></div><div><font face="courier new, monospace">  endforeach()</font></div>

<div><font face="courier new, monospace">endfunction()</font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">set(mylist a b c)</font></div><div><font face="courier new, monospace">set(mystring &quot;a b c&quot;)</font></div>

<div><font face="courier new, monospace">set(mylist_from_string ${mystring})</font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">print_list(mylist)</font></div><div>

<font face="courier new, monospace">print_list(mystring)</font></div><div><font face="courier new, monospace">print_list(mylist_from_string)</font></div></div><div><br></div><div>And here&#39;s what I get when I run it:</div>

<div><br></div><div><font face="courier new, monospace">cmake -P list-from-string.cmake</font></div><div><font face="courier new, monospace"><br></font></div><div><div><font face="courier new, monospace">mylist has 3 items</font></div>

<div><font face="courier new, monospace">mylist[0] = a</font></div><div><font face="courier new, monospace">mylist[1] = b</font></div><div><font face="courier new, monospace">mylist[2] = c</font></div><div><font face="courier new, monospace">mystring has 1 items</font></div>

<div><font face="courier new, monospace">mystring[0] = a b c</font></div><div><font face="courier new, monospace">mylist_from_string has 1 items</font></div><div><font face="courier new, monospace">mylist_from_string[0] = a b c</font></div>

</div><div><br></div>