[CMake] Running two executables sequentially in a test

David Cole david.cole at kitware.com
Mon May 2 14:56:26 EDT 2011


execute_process requires the COMMAND keyword.

  http://cmake.org/cmake/help/cmake-2-8-docs.html#command:execute_process

I think you should start looking around a little harder for some examples
and documentation before asking more about "how do I run a cmake script" on
this list.


Thanks,
David Cole


On Mon, May 2, 2011 at 2:50 PM, David Doria <daviddoria at gmail.com> wrote:

> On Mon, May 2, 2011 at 2:27 PM, Tyler <tyler at cryptio.net> wrote:
> > You could use -D flags (cmake -Dvar=value -P script.cmake).
>
> That seems reasonable. I tried it:
>
> CMakeLists.txt
> -------------
> cmake_minimum_required(VERSION 2.6)
>
> PROJECT(Test)
> ENABLE_TESTING()
>
> ADD_EXECUTABLE(Test1 Test1.cxx)
> ADD_EXECUTABLE(Test2 Test2.cxx)
>
> add_test(NAME MyTest COMMAND ${CMAKE_COMMAND} -Dcommand1=Test1
> -Dcommand2=Test2 -P ${CMAKE_CURRENT_SOURCE_DIR}/script.cmake)
>
> script.cmake
> -------------
> execute_process(command1)
> execute_process(command2)
>
> but CMake fails with:
> execute_process given unknown argument "command1".
>
> When I replace with:
> execute_process(${command1})
> execute_process(${command2})
>
> it still fails, but this time with:
> execute_process given unknown argument "Test1".
>
> I thought it might not have been looking in the right path or
> something, so I tried:
>
> add_test(NAME MyTest COMMAND ${CMAKE_COMMAND}
> -Dcommand1=${CMAKE_CURRENT_BINARY_DIR}/Test1
> -Dcommand2=${CMAKE_CURRENT_BINARY_DIR}/Test2 -P
> ${CMAKE_CURRENT_SOURCE_DIR}/script.cmake)
>
> but now it fails with:
> execute_process given unknown argument "/home/doriad/TestCMake/bin/Test1"
>
> That executable indeed exists and runs fine.
>
> -----------
> Also, to support previous versions I could just remove the NAME and
> COMMAND keywords to get:
>
> add_test(MyTest ${CMAKE_COMMAND} -Dcommand1=Test1 -Dcommand2=Test2 -P
> ${CMAKE_CURRENT_SOURCE_DIR}/script.cmake)
>
> right?
>
> David
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110502/e0b0a6a4/attachment.htm>


More information about the CMake mailing list