Hi!  The simple CMakeLists.txt

cmake_minimum_required(VERSION 2.8)
project(foo)
enable_testing()
add_test(NAME bar COMMAND cmd /c echo hello)

fails for me when run on Windows 7 64 bit (only platform I've tried)
with ctest 2.8.12 or 2.8.11.
"ctest -V -C Debug" outputs

...
test 1
    Start 1: bar

1: Test command: C:\Windows\System32\cmd.exe "/c" "echo" "hello"
1: Test timeout computed to be: 9.99988e+006
1: The syntax of the command is incorrect.
1/1 Test #1: bar ..............................***Failed    0.07 sec

Watching with ProcessMonitor, the only funky business I can see is
that ctest uses forward slashes in the path it passes to
CreateProcess.

Trying this with a little C program shows that, yes, cmd.exe outputs
"The syntax of the command is incorrect" if run with
    CreateProcess( NULL, "c:/windows/system32/cmd.exe /c echo hi", ...)
but executes properly if run with
    CreateProcess( NULL, "c:\\windows\\system32\\cmd.exe /c echo hi", ...)

The obvious workaround is... just use a bat file without mentioning cmd at all:

cmake_minimum_required(VERSION 2.8)
project(foo)
enable_testing()
add_test(NAME bar COMMAND foobar.bat)

If you forget to do chmod +x foobar.bat first, it'll fail with "***Not Run".

The only reason I'm posting this is because I forgot to do the chmod
+x, and tried using
cmd directly without a batch file as a minimal test case.  Bit of a detour :-)
- Dan
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to