Computer Assisted Medical Intervention Tool Kit  version 5.2
CamiTKTestCoverage.h
Go to the documentation of this file.
1 #------------------------------------------
2 # Manage CamiTK Test coverage
3 #-------------------------------------------
4 
5 # When using gcc, enable test coverage
6 # using https://github.com/bilke/cmake-modules/blob/master/CodeCoverage.cmake
7 # requires lcov to be installed on the machine
8 if(CMAKE_COMPILER_IS_GNUCXX)
9 
10  option(CAMITK_TEST_COVERAGE "Check this option to generate the 'camitk-ce-test-coverage' target that will create a coverage analysis report in ${PROJECT_BINARY_DIR}/camitk-ce-test-coverage" OFF)
11 
12  if (CAMITK_TEST_COVERAGE)
13  # CodeCoverage is an additional CMake modules published on github by Lars Bilke.
14  # it declares append_coverage_compiler_flags and setup_target_for_coverage macros
15  include(CodeCoverage)
16 
17  # First append gxx flags, this has to be done before any C++ project configuration takes place
18  append_coverage_compiler_flags()
19 
20  # Exclude the following files:
21  # - generated source file (in build dir)
22  # - installed library headers from coverage analysis
23  set(COVERAGE_EXCLUDES '${PROJECT_BINARY_DIR}/*'
24  '/usr/*')
25 
26  # Defines a specific target to run test coverage and reporting.
27  # This will create a specific camitk-ce-test-coverage target
28  # that, when run, will launch all the test known by ctest in parallel
29  # and generate a report in ${PROJECT_BINARY_DIR}/camitk-ce-test-coverage
30  #
31  # Note: you can run a quick test by bypassing some tests.
32  # e.g., to run only one test every 50 tests "-I 1,,50" (ctest documenation: -I Start,End,Stride,test#,test#
33  # Note: add "-V" or "-VV" for verbose, add "-R pattern" to run only specific test
34  setup_target_for_coverage(NAME camitk-ce-test-coverage
35  EXECUTABLE ctest --parallel 5)
36  endif()
37 
38 endif()
cmake modules macros camitk test endif() add_custom_target(camitk-ce-iwyu COMMAND $
Definition: CamiTKIncludeWhatYouUse.h:37
iwyu out CACHE PATH Output filename for include what you use set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE ${IWYU_EXECUTABLE}) if(NOT EXISTS $
Definition: CamiTKIncludeWhatYouUse.h:22
if(CMAKE_COMPILER_IS_GNUCXX) option(CAMITK_TEST_COVERAGE "Check this option to generate the 'camitk-ce-test-coverage' target that will create a coverage analysis report in $
Definition: CamiTKTestCoverage.h:8
static void include(QRect &r, const QRect &rect)
Definition: canvas_typed/qtcanvas.cpp:98
Definition: Action.cpp:36