ctest

How to run ctest after building my project with cmake

送分小仙女□ 提交于 2019-11-26 16:34:09
问题 I want my tests to be launched each time my project is successfully built. And if some tests are broken I want my build to be broken too. By default I need to run tests manually by running ctest command. CTest can actually build project but I use IDE that invokes make to build sources. And make doesn't run tests. I add this command to my root CMakeLists.txt file but it doesn't work. add_custom_command(OUTPUT tests.txt POST_BUILD COMMAND ctest --output-on-failure) CMake doesn't return any

CMake & CTest : make test doesn't build tests

时光总嘲笑我的痴心妄想 提交于 2019-11-26 12:54:32
I'm trying CTest in CMake in order to automatically run some of my tests using make test target. The problem is CMake does not "understand" that the test I'm willing to run has to be built since it is part of the project. So I'm looking for a way to explicitly specify this dependency. richq It is arguably a bug in CMake (previously tracked here ) that this doesn't work out of the box. A workaround is to do the following: add_test(TestName ExeName) add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} DEPENDS ExeName) Then you can run make check and it will compile and run the test. If you

CMake & CTest : make test doesn't build tests

爱⌒轻易说出口 提交于 2019-11-26 03:10:03
问题 I\'m trying CTest in CMake in order to automatically run some of my tests using make test target. The problem is CMake does not \"understand\" that the test I\'m willing to run has to be built since it is part of the project. So I\'m looking for a way to explicitly specify this dependency. 回答1: It is arguably a bug in CMake (previously tracked here) that this doesn't work out of the box. A workaround is to do the following: add_test(TestName ExeName) add_custom_target(check COMMAND ${CMAKE