Add code coverage support

make coverage runs the test_suite and generates a report
This commit is contained in:
Florent Le Coz
2015-10-29 02:33:05 +01:00
parent 3c1889fbd0
commit 6ae7e08c52
3 changed files with 218 additions and 2 deletions
+11 -1
View File
@@ -7,6 +7,7 @@ set(${PROJECT_NAME}_VERSION_MINOR 0)
set(${PROJECT_NAME}_VERSION_SUFFIX "~dev")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y -pedantic -Wall -Wextra")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage --coverage")
# Define a __FILENAME__ macro to get the filename of each file, instead of
# the full path as in __FILE__
@@ -182,6 +183,15 @@ add_dependencies(test_suite catch)
add_custom_target(check COMMAND "test_suite"
DEPENDS test_suite)
#
## Code coverage
#
include(CodeCoverage)
SETUP_TARGET_FOR_COVERAGE(coverage
test_suite
coverage
)
#
## Install target
#
@@ -213,4 +223,4 @@ endif()
add_custom_target(PrintBuildParameters ALL
${CMAKE_COMMAND} -E cmake_echo_color --cyan "Compiling ${PROJECT_NAME} with ${STR_WITH_BOTAN}, ${STR_WITH_CARES}")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/biboumi.h.cmake ${CMAKE_BINARY_DIR}/src/biboumi.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/biboumi.h.cmake ${CMAKE_BINARY_DIR}/src/biboumi.h)