From 3f42c2dcd48db09f37adc2d1cd884113e6936821 Mon Sep 17 00:00:00 2001 From: Stefan Radomski Date: Fri, 12 Apr 2013 19:12:38 +0200 Subject: Link against gcov with gcc in debug builds --- CMakeLists.txt | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9989b38..05ecd83 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -166,6 +166,11 @@ include("${CMAKE_MODULE_PATH}/USCXMLMacros.cmake") include("${CMAKE_MODULE_PATH}/FunctionExists.cmake") include("${CMAKE_MODULE_PATH}/HeaderExists.cmake") +# we need USCXML_CORE_LIBS here for -lgcov +set(USCXML_CORE_LIBS) +set(USCXML_OPT_LIBS) +set(USCXML_FILES) + # some compiler flags #message("CMAKE_CXX_COMPILER_ID: ${CMAKE_CXX_COMPILER_ID}") @@ -180,9 +185,12 @@ if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") add_definitions(-fPIC) add_definitions(-Wunreachable-code) - # coverage information - add_definitions(-fprofile-arcs) - add_definitions(-ftest-coverage) + if (CMAKE_BUILD_TYPE MATCHES ".*Deb.*") # when not building for debug + # coverage information + add_definitions(-fprofile-arcs) + add_definitions(-ftest-coverage) + list (APPEND USCXML_CORE_LIBS "gcov") + endif() # all warnings add_definitions(-Wall) @@ -306,10 +314,6 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}) # Dependent libraries ############################################################ -set(USCXML_CORE_LIBS) -set(USCXML_OPT_LIBS) -set(USCXML_FILES) - if (NOT WIN32) # libxml2 find_package(LibXml2 REQUIRED) -- cgit v0.12