[CMake] Ctest memcheck trickery

Leif Walsh leif.walsh at gmail.com
Mon Apr 23 11:19:48 EDT 2012


Hi,

Another question:

I want to be able to run my tests with and without valgrind. A few tests should always run without valgrind, and a few others should run with helgrind and still others with drd. 

Currently, I have a function add_memcheck_test that invokes add_test twice and creates targets foo_test and memcheck_foo_test (and similar for helgrind and drd). So most tests use that, and a few that shouldn't use valgrind at all just use add_test. So I can run ctest -R memcheck or ctest -E memcheck to decide whether to use valgrind or not. 

But this seems like not the cmake way. I feel like I should be instead running ctest -D Experimental or ctest -D ExperimentalMemCheck.

Is there a way to use these but still be able to disable valgrind for a few tests and to change the options (--tool=helgrind for example) for a few others? Something like set properties on those tests, to set CMAKE_MEMORYCHECK_COMMAND(_OPTIONS) or whatever it is?

Sent from my iPhone


More information about the CMake mailing list