diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 41a6b9403..0f8a4b672 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -204,12 +204,6 @@ endif() if(CMAKE_COMPILER_IS_GNUCXX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wcast-align") - - if(WITH_COVERAGE) - # Include code coverage, use with -DCMAKE_BUILD_TYPE=Coverage - include(CodeCoverage) - setup_target_for_coverage(kp_coverage "make test" coverage) - endif() endif() if(CMAKE_COMPILER_IS_GNUCC) @@ -291,6 +285,21 @@ if(WITH_TESTS) enable_testing() endif(WITH_TESTS) +if(WITH_COVERAGE) + # Include code coverage, use with -DCMAKE_BUILD_TYPE=Debug + include(CodeCoverage) + set(COVERAGE_GCOVR_EXCLUDES + "\\(.+/\\)?tests/.\\*" + ".\\*/moc_\\[^/\\]+\\.cpp" + ".\\*/ui_\\[^/\\]+\\.h" + "\\(.+/\\)?zxcvbn/.\\*") + append_coverage_compiler_flags() + setup_target_for_coverage_gcovr_html( + NAME coverage + EXECUTABLE $(MAKE) && $(MAKE) test + ) +endif() + include(CLangFormat) if(UNIX AND NOT APPLE) |