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 w
My case was simple enough that I just used a custom target:
project(bftest)
add_executable(bftest main.c)
target_link_libraries(bftest LINK_PUBLIC bf)
find_program(VALGRIND "valgrind")
if(VALGRIND)
add_custom_target(valgrind
COMMAND "${VALGRIND}" --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes $)
endif()