[CMake] Problems with execute_process under Windows

Eric Noulard eric.noulard at gmail.com
Sun May 10 13:12:33 EDT 2009


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.

Does your "file" variable content comes from CMake file command
of some sort?


> Is there any way to show the real command that CMake tries to run?

Normally
 cmake --trace --debug-output

should help but its seems that those commands do not exhibit enough
cmake "verbosity".

-- 
Erk


More information about the CMake mailing list