From 8b5224acc34f0417d9a22b16aeb9060886829916 Mon Sep 17 00:00:00 2001 From: Holger Freyther Date: Wed, 27 Sep 2006 18:06:51 +0000 Subject: Add a new CMAKE_BUILD_TYPE called 'profile' for gcc on linux and apple If you use gcc and either linux or apple and use -DCMAKE_BUILD_TYPE=profile you have about the same configuration as debugfull but additionally gcc test coverage is enabled. This needs to be enabled when compiling and linking. I add this to enable creating nice test coverage graphs I have seen at http://venge.net/monotone svn path=/trunk/KDE/kdelibs/; revision=589181 --- modules/FindKDE4Internal.cmake | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/modules/FindKDE4Internal.cmake b/modules/FindKDE4Internal.cmake index a9ebef63..aec56bd8 100644 --- a/modules/FindKDE4Internal.cmake +++ b/modules/FindKDE4Internal.cmake @@ -553,6 +553,12 @@ if (APPLE) #set(CMAKE_SHARED_LINKER_FLAGS "-single_module -undefined dynamic_lookup -multiply_defined suppress") #set(CMAKE_MODULE_LINKER_FLAGS "-undefined dynamic_lookup -multiply_defined suppress") + # we profile... + if(CMAKE_BUILD_TYPE_TOLOWER MATCHES profile) + set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fprofile-arcs -ftest-coverage") + set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage") + endif(CMAKE_BUILD_TYPE_TOLOWER MATCHES profile) + # removed -Os, was there a special reason for using -Os instead of -O2 ?, Alex # optimization flags are set below for the various build types set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-common") @@ -565,6 +571,11 @@ if (CMAKE_SYSTEM_NAME MATCHES Linux) set ( _KDE4_PLATFORM_DEFINITIONS -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_GNU_SOURCE) set ( CMAKE_SHARED_LINKER_FLAGS "-Wl,--fatal-warnings -Wl,--no-undefined -lc") set ( CMAKE_MODULE_LINKER_FLAGS "-Wl,--fatal-warnings -Wl,--no-undefined -lc") + # we profile... + if(CMAKE_BUILD_TYPE_TOLOWER MATCHES profile) + set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fprofile-arcs -ftest-coverage") + set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage") + endif(CMAKE_BUILD_TYPE_TOLOWER MATCHES profile) endif (CMAKE_COMPILER_IS_GNUCXX) if (CMAKE_C_COMPILER MATCHES "icc") set ( _KDE4_PLATFORM_DEFINITIONS -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_GNU_SOURCE) @@ -592,10 +603,12 @@ if (CMAKE_COMPILER_IS_GNUCXX) set(CMAKE_CXX_FLAGS_RELEASE "-O2") set(CMAKE_CXX_FLAGS_DEBUG "-g -O2 -fno-reorder-blocks -fno-schedule-insns -fno-inline") set(CMAKE_CXX_FLAGS_DEBUGFULL "-g3 -fno-inline") + set(CMAKE_CXX_FLAGS_PROFILE "-g3 -fno-inline -ftest-coverage -fprofile-arcs") set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g") set(CMAKE_C_FLAGS_RELEASE "-O2") set(CMAKE_C_FLAGS_DEBUG "-g -O2 -fno-reorder-blocks -fno-schedule-insns -fno-inline") set(CMAKE_C_FLAGS_DEBUGFULL "-g3 -fno-inline") + set(CMAKE_C_FLAGS_PROFILE "-g3 -fno-inline -ftest-coverage -fprofile-arcs") if (CMAKE_SYSTEM_NAME MATCHES Linux) set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long -ansi -Wundef -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common") -- cgit v1.2.1