How do I make ctest run a program with valgrind without dart?

后端 未结 4 2096
生来不讨喜
生来不讨喜 2021-01-31 09:16

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

4条回答
  •  甜味超标
    2021-01-31 09:59

    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()
    

提交回复
热议问题