Skip to content
Snippets Groups Projects
Commit 5ea49cb3 authored by Millian Poquet's avatar Millian Poquet
Browse files

[cmake] do_coverage option

parent 273f7f91
No related branches found
No related tags found
No related merge requests found
...@@ -10,6 +10,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") ...@@ -10,6 +10,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
# Options # Options
option(enable_warnings "Enable compilation warnings" ON) option(enable_warnings "Enable compilation warnings" ON)
option(treat_warnings_as_errors "Treat compilation warnings as compilation errors" OFF) option(treat_warnings_as_errors "Treat compilation warnings as compilation errors" OFF)
option(do_coverage "Compile in coverage mode" OFF)
# Build type # Build type
# Set a default build type if none was specified # Set a default build type if none was specified
...@@ -25,6 +26,15 @@ endif() ...@@ -25,6 +26,15 @@ endif()
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Coverage
if (do_coverage)
set(coverage_cxxflags "-g -O0 -fprofile-arcs -ftest-coverage")
set(coverage_ldflags "-lgcov --coverage")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${coverage_cxxflags}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${coverage_ldflags}")
endif()
# Dependencies # Dependencies
## Boost ## Boost
find_package(Boost 1.48 REQUIRED COMPONENTS regex locale) find_package(Boost 1.48 REQUIRED COMPONENTS regex locale)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment