[CMake] Problems with execute_process under Windows

Tanguy Krotoff tkrotoff at gmail.com
Sun May 10 13:21:39 EDT 2009


btw you forgot to attach your unix example :p

On Sun, May 10, 2009 at 7:19 PM, Eric Noulard <eric.noulard at gmail.com> wrote:
> 2009/5/10 Eric Noulard <eric.noulard at gmail.com>:
>> 2009/5/10 Tanguy Krotoff <tkrotoff at gmail.com>:
>>> Hello
>>>
>>> I'm pulling my hair out on what should be straightforward.
>>>
>>>        file(TO_NATIVE_PATH ${file} file_native)
>>>        execute_process(
>>>                COMMAND type \"${file_native}\"
>>>                RESULT_VARIABLE result
>>>                OUTPUT_VARIABLE output
>>>                ERROR_VARIABLE error
>>>        )
>>>        message("result=${result}")
>>>        message("output=${output}")
>>>        message("error=${error}")
>>>
>>> I'm running this under Windows and it gave me this output:
>>>
>>> result=0
>>> output=
>>> error="C:\Documents and
>>> Settings\tanguy_k\Desktop\phonon-vlc-mplayer\trunk\AUTHORS" not found
>>>
>>> Of course the file exist and if i enter
>>>        type "C:\Documents and
>>> Settings\tanguy_k\Desktop\phonon-vlc-mplayer\trunk\AUTHORS"
>>> inside a DOS command prompt everything works fine.
>>>
>>> It's like CMake does something to the filename that I don't understand
>>
>> I do have weird behavior on Unix too,
>> with filename with embbeded "space" in them.
>>
>> It looks like I must NOT TO_NATIVE_PATH for make it work?
>>
>> My unix example is attached.
>> try:
>> cmake -P buggy_execute.cmake
>>
>>> Any idea why?
>>
>> Nope.
>> Looks like there is trouble with escaped character.
>
> On linux with CMake 2.6.4, execute_process seems to automatically escape
> character... (at least space or '\')
>
> strace-ing my previous example gives:
>
> execve("/usr/local/bin/dir", ["dir", "/home/eric/with\\ space\\ in\\
> it.txt ....)
>
>
>
> --
> Erk
>



-- 
Tanguy Krotoff <tkrotoff at gmail.com>
+33 6 68 42 70 24


More information about the CMake mailing list