Skip to content

Commit

Permalink
Merge pull request #541 from analogdevicesinc/rgetz-add-gcov
Browse files Browse the repository at this point in the history
cmake: add gcov support for looking at test coverage
  • Loading branch information
dNechita authored Jun 5, 2020
2 parents 268c968 + bbc9411 commit cbaa2db
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,12 @@ if (MSVC)
add_compile_options(/WX)
endif()
elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
option(WITH_GCOV "Build with gcov profiling flags" OFF)
if (WITH_GCOV)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
endif()
if(DEFINED ENV{CI} AND (DEFINED ENV{TRAVIS} OR DEFINED ENV{APPVEYOR}))
message(STATUS "Running in CI environment (Travis or AppVeyor), setting -Werror")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
Expand Down

0 comments on commit cbaa2db

Please sign in to comment.