We used find_program(MEMORYCHECK_COMMAND NAMES valgrind) to find Valgrind and set MEMORYCHECK_COMMAND to its full path. We also needed to explicitly include the CTest module to enable the memcheck test action, which we can employ by using ctest -T memcheck. Also, observe that we were able to pass options to Valgrind using set(MEMORYCHECK_COMMAND_OPTIONS "--trace-children=yes --leak-check=full"). The memory checking step creates a log file, which can be used to inspect the memory defect in detail.
Some tools, like code coverage and static analysis tools, can be set up similarly. The use of some of these tools is, however, more complicated, since specialized builds and toolchains are required. Sanitizers are one such example. For more information, see https://github.com/arsenm/sanitizers-cmake. Also, check out Chapter 14, Testing Dashboards, for a discussion of the AddressSanitizer and ThreadSanitizer.