Skip to content

Commit dd967cc

Browse files
author
Clement Champetier
committed
CMake: add coverage flag with CMake option AVTRANSCODER_COVERAGE
From the GNU GCC man: --coverage This option is used to compile and link code instrumented for coverage analysis. The option is a synonym for -fprofile-arcs -ftest-coverage (when compiling) and -lgcov (when linking).
1 parent 7282c97 commit dd967cc

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ else()
2828
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fPIC -O3")
2929
endif()
3030

31+
# CPP flag to create code coverage report
32+
if(AVTRANSCODER_COVERAGE)
33+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
34+
endif()
3135

3236
add_subdirectory(src)
3337

0 commit comments

Comments
 (0)