I want to write a CMakeLists.txt so that I can run my tests normally or with valgrind. I have seen much on integrating ctest with valgrind but all with the assumption that you want to set up a server to submit test results to a dart dashboard. I just want to run the tests on my machine and see the results on the command line.
If I have to do a cmake -D VALGRIND=ON thats fine, but I'd rather generate tests named "foo" and "valgrind_foo" if possible.
I use valgrind for my memory check. To configure valgrind, I define the following variables in my build system:
Also, in there is my valgrind suppression file:
After you write your CMakeLists.txt files and configure valgrind correctly in them, you can run the following command:
This will trick your build system to run the test automation locally. It expects you to run:
next, to submit to the (default or your) Dashboard, but you don't need to go through this step to run what you want. The results will be stored in the Testing/Temporary/ directory.
It seems the following is sufficient. I wasn't using separate_arguments before, that was my stupidity.
My case was simple enough that I just used a custom target: