I need to design a test (= a bash script) such that : 1) run a dedicated executable for the test (to be compiled) 2) diff the run output with a reference log file
The test is created with : add_test(mytest ./mytest.sh). The bash script would look like: >> more mytest.sh /path/to/mytestexe > out.log diff out.log out.ref The dedicated executable for the test is created with : add_executable(mytestexe mytestexe.cpp) Ideally, I would like mytestexe to be compiled when I type "make test" (before to run the test) but not "make". Seems impossible to add a dependencie with : add_dependencies(mytest mytestexe). I googled this and found https://stackoverflow.com/questions/733475/cmake-ctest-make-test-doesnt-build-tests but this was not really clear to me...I added : add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} DEPENDS mytestexe). The 2 unexpected problems I have left are: 1) mytestexe is compiled everytime I type "make" which is a solution but is not really what I am looking for (also compiled when I type "make check" which is expected). => is there a way for make not to compile mytestexe (note I didn't added ALL in add_custom_target so I am not sure to know why make builds mytestexe) 2) Also the verbosity is broken with check : make test ARGS="-V" is verbose , but, make check ARGS="-V" is not. => how to deal with that ?
-- 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: https://cmake.org/mailman/listinfo/cmake
