[CMake] Command line arguments to tests and VS projects

Nagy-Egri Máté Ferenc nagymatef at freemail.hu
Fri Mar 28 04:26:32 EDT 2014


Hi!


I am having trouble passing command line arguments to unit tests using the add_test() command. It seems that the arguments are always cut off, no matter what I do. I have tried


add_test( NAME TestSTLArithmetics COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/TestSTLArithmetics “-L 31”)


add_test( NAME TestSTLArithmetics COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/TestSTLArithmetics -L 31)


add_test( NAME TestSTLArithmetics COMMAND “${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/TestSTLArithmetics -L 31”)


But none of these work.


As for the Visual Studio part, I would like to have the tests seperately have command line arguments, not just when called by the RUN_TESTS project.


Here is the Visual Studio specific part of my CMakeFile.txt:


if(MSVC_VERSION)
 set_target_properties (TestSTLArithmetics PROPERTIES COMPILE_FLAGS ${MSVC_COMPILER_FLAGS})
 set_target_properties (TestSTLArithmetics PROPERTIES LINK_FLAGS ${MSVC_LINKER_FLAGS})
 
 set_target_properties (TestSTLArithmetics PROPERTIES COMMAND_ARGUMENTS "-L 31")
endif(MSVC_VERSION)


But nothing happens inside the project file.


What is the correct syntax to do these?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20140328/abff9384/attachment.html>


More information about the CMake mailing list