From 006dcde403242ba9c24fea9660a6c38b3ad07133 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Mon, 29 Jul 2019 18:57:41 +0200 Subject: [PATCH] Better usage of --coverage flags --- cmake/compilerFlags.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmake/compilerFlags.cmake b/cmake/compilerFlags.cmake index cb8f30b2..75283ca9 100644 --- a/cmake/compilerFlags.cmake +++ b/cmake/compilerFlags.cmake @@ -32,9 +32,10 @@ if ( MINGW OR UNIX OR MSYS ) # MINGW, Linux, APPLE, CYGWIN endif() if(BUILD_WITH_COVERAGE) - # Note: We tried to use here add_compile_options but we got linker errors on Travis-CI - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -fprofile-arcs -ftest-coverage") + add_compile_options(--coverage) + # TODO: From CMake 3.13 we could use add_link_options instead these 2 lines set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage") endif() add_compile_options(-Wall -Wcast-align -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Woverloaded-virtual -W)