Skip to content

Commit 799bcab

Browse files
authored
Merge pull request ceph#57594 from connorfawcett/gcov
cmake: Add gcov linker options when coverage option is set Reviewed-by: Kefu Chai <[email protected]>
2 parents 8c4f910 + 1d8dfb5 commit 799bcab

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,6 @@ if(WITH_BABELTRACE)
637637
endif(WITH_BABELTRACE)
638638

639639
option(DEBUG_GATHER "C_Gather debugging is enabled" ON)
640-
option(ENABLE_COVERAGE "Coverage is enabled" OFF)
641640
option(PG_DEBUG_REFS "PG Ref debugging is enabled" OFF)
642641

643642
option(WITH_TESTS "enable the build of ceph-test package scripts/binaries" ON)

src/CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,15 +263,18 @@ if(LINUX OR APPLE)
263263
list(APPEND EXTRALIBS ${LIB_RESOLV})
264264
endif()
265265

266+
option(ENABLE_COVERAGE "Coverage is enabled" OFF)
266267
if(${ENABLE_COVERAGE})
267268
find_program(HAVE_GCOV gcov)
268269
if(NOT HAVE_GCOV)
269270
message(FATAL_ERROR "Coverage Enabled but gcov Not Found")
270271
endif()
271272
add_compile_options(
272-
-fprofile-arcs
273-
-ftest-coverage
273+
--coverage
274274
-O0)
275+
add_link_options(
276+
--coverage
277+
)
275278
list(APPEND EXTRALIBS gcov)
276279
endif(${ENABLE_COVERAGE})
277280

0 commit comments

Comments
 (0)