[CMake] Configuring .bat file with native path under windows

Nicolas Desprès nicolas.despres at gmail.com
Wed Oct 15 04:19:53 EDT 2008


set(single_path "c:/foo/bar")
set(several_paths "c:/foo/1.txt;c:/bar/2.txt")
file(TO_NATIVE_PATH "${single_path}" single_path_result)
file(TO_NATIVE_PATH "${several_paths}" several_paths_result)
message("single='${single_path_result}'")
message("several='${several_paths_result}'")


On Tue, Oct 14, 2008 at 6:16 PM, Eric Noulard <eric.noulard at gmail.com> wrote:
> 2008/10/14 Nicolas Desprès <nicolas.despres at gmail.com>:
>> On Tue, Oct 14, 2008 at 4:48 PM, Andy Lego <andy at legoandy.com> wrote:
>>> Hi,
>>>
>>> Look at FILE and STRING commands.
>>
>> Thanks. That's what I did.
>
> May be
>
> FILE(TO_NATIVE_PATH ${in} ${out})
>
> is easier than string(REPLACE ...
>
>  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.
>

For some reason, I don't understand the following line did not work...

     file(TO_NATIVE_PATH "${${var}}" ${var}_in)

-- 
Nicolas Desprès


More information about the CMake mailing list