<div dir="ltr"><div><div>Hi Allen.<br><br></div>I'm not sure whether it's documented, but CMake interprets square brackets as escaping the semi-colon character (which means a semi-colon in square brackets will not work as a list item separator). You will probably have to translate the file names for CMake processing by replacing [ and ] with a different string, and replacing it back just before use outside of CMake.<br><br></div>Petr<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 17, 2016 at 5:38 PM, Allen Barnett <span dir="ltr"><<a href="mailto:allenbarnett5@gmail.com" target="_blank">allenbarnett5@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div><div><div>I inherited a set of files with somewhat unusual file names. In particular, there were a couple of files whose names included a single square bracket character. I processed these files with the file( GLOB ...) command and then iterated over the resulting list with foreach. However, the foreach command does not seem to break the resulting list apart correctly. To make this concrete, I have a directory with files named "a", "b[", and "c". file( GLOB FILES "*" ) returns the list:<br><br>/home/allen/test/b[;/home/allen/test/c;/home/allen/test/a<br></div><br>However, <br></div><br>foreach( FILE ${FILES} )<br></div>  message( ${FILE} )<br></div>endforeach()<br></div><br>just prints the same thing. That is, foreach does not split FILES into separate pieces. If I rename "b[" to "b]" I see the same behavior. If I rename "b[" to "b[]" (or even "b]["), then foreach successfully splits FILES into the individual file names.<br><br></div>I'm using CMake 3.3.2. I see the same thing on linux and windows.<br><br></div>Thanks,<br></div>Allen<br clear="all"><div><div><div><div><div><div><div><div><div><div><div></div></div></div></div></div></div></div></div></div></div></div></div>
<br>--<br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br></blockquote></div><br></div>