[CMake] [PATCH] SEPARATE_ARGUMENTS: don't replace escaped spaces

Brandon J. Van Every bvanevery at gmail.com
Sun Jul 16 18:01:02 EDT 2006


Alexander Neundorf wrote:
> Von: "Brandon J. Van Every"
>   
>> Alexander Neundorf wrote:
>>     
>>> Hi,
>>>
>>> the attached patch changes the behaviour of SEPARATE_ARGUMENTS() so that
>>>       
>> it doesn't replace escaped spaces anymore.
>>
>> Great!  I've been running into this and just working around it 
>> manually.  Another issue: if the arguments contain quoted strings with 
>> spaces in them, they really shouldn't be broken apart.
>>     
>
> Do you have a simple example ?
>   

MACRO(MAKE_WINDOWS_PATH pathname)
  # An extra \\ escape is necessary to get a \ through CMake's processing.
  STRING(REPLACE "/" "\\" ${pathname} "${${pathname}}")
  # Enclose with UNESCAPED quotes.  This means we need to escape our
  # quotes once here, i.e. with \"
  SET(${pathname} \"${${pathname}}\")
ENDMACRO(MAKE_WINDOWS_PATH)

SET(MYPATH "C:/Program Files/Chicken")
MESSAGE("${MYPATH}")
MAKE_WINDOWS_PATH(MYPATH)
MESSAGE("${MYPATH}")
SEPARATE_ARGUMENTS(MYPATH)
MESSAGE("${MYPATH}")


Brandon J. Van Every at KAHLO ~
$ cmake -P windowspath.cmake
C:/Program Files/Chicken
"C:\Program Files\Chicken"
"C:\Program;Files\Chicken"



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20060716/2dcb3abc/attachment.html


More information about the CMake mailing list