[CMake] Running two executables sequentially in a test
David Doria
daviddoria at gmail.com
Mon May 2 14:50:02 EDT 2011
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
More information about the CMake
mailing list