Hi Allen. 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.
Petr On Thu, Mar 17, 2016 at 5:38 PM, Allen Barnett <allenbarne...@gmail.com> wrote: > 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: > > /home/allen/test/b[;/home/allen/test/c;/home/allen/test/a > > However, > > foreach( FILE ${FILES} ) > message( ${FILE} ) > endforeach() > > 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. > > I'm using CMake 3.3.2. I see the same thing on linux and windows. > > Thanks, > Allen > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake >
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake