[CMake] [PATCH] SEPARATE_ARGUMENTS: don't replace escaped spaces
William A. Hoffman
billlist at nycap.rr.com
Sun Jul 16 21:07:40 EDT 2006
At 06:01 PM 7/16/2006, Brandon J. Van Every wrote:
>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"
Why not use TO_NATIVE_PATH for that:
* FILE(TO_CMAKE_PATH path result)
* FILE(TO_NATIVE_PATH path result)
* TO_CMAKE_PATH will convert path into a cmake sytle path with unix /. The input can be a single path or a system path like "$ENV{PATH}". Note the double quotes around the ENV call TO_CMAKE_PATH only takes one argument.
* TO_NATIVE_PATH works just like TO_CMAKE_PATH, but will convert from a cmake style path into the native path style \ for windows and / for UNIX.
More information about the CMake
mailing list