aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHolger Freyther <holger+kde@freyther.de>2006-09-27 18:06:51 +0000
committerHolger Freyther <holger+kde@freyther.de>2006-09-27 18:06:51 +0000
commit8b5224acc34f0417d9a22b16aeb9060886829916 (patch)
treea6c5c5246cb77d262a45a7c4a3cc90c1a186db3e
parenta42e1a32d04c5598067f69bddc6dc1211724f1dd (diff)
downloadextra-cmake-modules-8b5224acc34f0417d9a22b16aeb9060886829916.tar.gz
extra-cmake-modules-8b5224acc34f0417d9a22b16aeb9060886829916.tar.bz2
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
-rw-r--r--modules/FindKDE4Internal.cmake13
1 files changed, 13 insertions, 0 deletions
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")