[CMake] execute_process() - problems on windows (newbie)

Robert Valkenburg rj.valkenburg at gmail.com
Mon Aug 2 19:29:32 EDT 2010


Hi,

This could well be a silly question. I'm having some issues with
execute_process() on windows platforms.  Below is a small test program with
output on windows and linux.  The only command i can get to work on windows
is "hostname", everything else i've tried gives the output below (internal
and external dos commands, and other commands such as Matlabs mexext). All
the commands work properly in the dos command shell.  Under unix it all
seems to work as expected.

Is there anything obvious that needs to set up etc for this to work under
windows?

If i add
    message("$ENV{PATH}")
to the small test below it correctly prints out the full path on both
windows and unix.

Thanks in advance.


# start test execute_process #######################################

cmake_minimum_required (VERSION 2.6)
project ("test execute_process")

execute_process(COMMAND  "ver" RESULT_VARIABLE result
                           OUTPUT_VARIABLE  output
OUTPUT_STRIP_TRAILING_WHITESPACE
                           ERROR_VARIABLE  error)

message( "result      = " ${result} )
message( "output      = " ${output} )
message( "error       = " ${error} )


# end test execute_process ########################################


Output on Windows XP i686 and Windows 7 x86_64 with cmake 2.8.1 gui
------------------------------------------------------------------------------------

Here is the output with the ver, "date /t", mexext  etc.
The only command that worked was hostname.

result      = The system cannot find the file specified
output      =
error       =
Configuring done


Output on Unix - Linux Fedora core 11  x86_64 cmake 2.6-patch 4 gui
-------------------------------------------------------------------------------------

Used identical CMakeLists.txt file except replaced with a suitable unix
command.  e.g. here is the output with "date".  Every command tried worked
correctly.


result      = 0
output      = Fri Jul 30 13:21:48 NZST 2010
error       =
-- Configuring done
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100803/266cc28d/attachment-0001.htm>


More information about the CMake mailing list