"A single pair of square brackets with ; inside have also long been
used to designate registry [key;value] pairs on Windows."

http://stackoverflow.com/a/36085151/236192


HTH,
David C.


On Fri, Mar 18, 2016 at 8:21 AM, Allen Barnett <allenbarne...@gmail.com> wrote:
> Hi Petr: You're right! If I rename "c" to "c]", it treats the whole
> "/home/allen/test/b[;/home/allen/test/c]" as an element of the list. The
> other file names are correctly split apart.
> Thanks,
> Allen
>
> On Fri, Mar 18, 2016 at 3:17 AM, Petr Kmoch <petr.km...@gmail.com> wrote:
>>
>> 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
-- 

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

Reply via email to