Skip to content

Commit

Permalink
Add USE_GCOV to CMakeLists.txt
Browse files Browse the repository at this point in the history
Enable use of compiler --coverage option by passing -DUSE_GCOV=ON
to CMake (the default is OFF)
  • Loading branch information
equalsraf committed May 2, 2015
1 parent 721e778 commit d581646
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR
add_definitions(-Werror -Wall -Wextra -Wno-unused-parameter -std=c++11 -Wfatal-errors)
endif()

option(USE_GCOV "Enable gcov support" OFF)
if(USE_GCOV)
message(STATUS "Enabling coverage")
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} --coverage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage")
endif()

set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
set(CMAKE_INCLUDE_CURRENT_DIR ON)

Expand Down

0 comments on commit d581646

Please sign in to comment.