aboutsummaryrefslogtreecommitdiff
path: root/cmake/Modules/EnableCoverage.cmake
blob: 9602869521458f5d44a5e26464c9ffc17fa42d6c (plain)
1
2
3
4
5
6
7
8
9
function (enable_coverage TARGET)
    target_compile_options("${TARGET}" PRIVATE
        "$<$<AND:$<CXX_COMPILER_ID:GNU,Clang>,$<CONFIG:Debug>>:-fcondition-coverage>"
        "$<$<AND:$<CXX_COMPILER_ID:GNU,Clang>,$<CONFIG:Debug>>:--coverage>"
    )
    target_link_libraries("${TARGET}" PRIVATE
        "$<$<AND:$<CXX_COMPILER_ID:GNU,Clang>,$<CONFIG:Debug>>:gcov>"
    )
endfunction ()