summaryrefslogtreecommitdiff
path: root/cmake/Modules/EnableCoverage.cmake
blob: 74dfe38df011b318889f72456c349e6d964cd44f (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
    "gcov"
  )
endfunction()