[extra-cmake-modules] kde-modules: Remove custom build types

Alex Merry kde at randomguy3.me.uk
Tue Jan 7 19:13:40 UTC 2014


Git commit 4068592ad9aa3f241027f6dbd6aff5f756671fd3 by Alex Merry.
Committed on 03/01/2014 at 12:14.
Pushed by alexmerry into branch 'master'.

Remove custom build types

KDECompilerSettings.cmake no longer alters CMake's built-in build types
or adds its own.  The "debug" build type therefore simply sets -g with
no additional flags (rather than -O2 and, depending on the compiler,
some no-inline/no-reorder flags as previously), the "release" build
types no longer set -DQT_NO_DEBUG and the "debugfull", "profile" and
"coverage" build types no longer exist.

QT_NO_DEBUG is set by Qt's CMake scripts depending on the build type of
Qt itself.  "debugfull" mostly set -g3, allowing macro expansion when
debugging; users can set this flag using environment variables if they
wish.  "RelWithDebugInfo" should be used instead of "profile" (according
to dfaure); -fprofile-arcs and -ftest-coverage are easy enough to add to
$CXX_FLAGS if they are required (formerly set by "profile" and
"coverage").

You should now use
cmake -DCMAKE_BUILD_TYPE=debug
instead of
cmake -DCMAKE_BUILD_TYPE=debugfull

CCMAIL: kde-frameworks-devel at kde.org

REVIEW: 114885

M  +7    -80   kde-modules/KDECompilerSettings.cmake

http://commits.kde.org/extra-cmake-modules/4068592ad9aa3f241027f6dbd6aff5f756671fd3

diff --git a/kde-modules/KDECompilerSettings.cmake b/kde-modules/KDECompilerSettings.cmake
index 72824e1..cb255f6 100644
--- a/kde-modules/KDECompilerSettings.cmake
+++ b/kde-modules/KDECompilerSettings.cmake
@@ -1,31 +1,13 @@
-# This module provides the following variables:
-#   KDE_ENABLE_EXCEPTIONS - use this to enable exceptions
-#
-# This module also sets up CMAKE_CXX_FLAGS for a set of predefined buildtypes
-# as documented below.
+# This module sets more useful CMAKE_CXX_FLAGS.
 #
-#  A note on the possible values for CMAKE_BUILD_TYPE and how KDE handles
-#  the flags for those buildtypes. FindKDE4Internal supports the values
-#  Debug, Release, RelWithDebInfo, Profile and Debugfull:
-#
-#  Release
-#          optimised for speed, qDebug/kDebug turned off, no debug symbols, no asserts
-#  RelWithDebInfo (Release with debug info)
-#          similar to Release, optimised for speed, but with debugging symbols on (-g)
-#  Debug
-#          optimised but debuggable, debugging on (-g)
-#          (-fno-reorder-blocks -fno-schedule-insns -fno-inline)
-#  DebugFull
-#          no optimisation, full debugging on (-g3)
-#  Profile
-#          DebugFull + -ftest-coverage -fprofile-arcs
+# In particular, it enables many more warnings than the default,
+# and sets stricter modes for some compiler features.  By default,
+# it disables exceptions.
 #
+# This module provides the following variables:
+#   KDE_ENABLE_EXCEPTIONS - use this to enable exceptions, as in
+#                           set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE_ENABLE_EXCEPTIONS}")
 #
-#  The default buildtype is RelWithDebInfo.
-#  It is expected that the "Debug" build type be still debuggable with gdb
-#  without going all over the place, but still produce better performance.
-#  It's also important to note that gcc cannot detect all warning conditions
-#  unless the optimiser is active.
 
 include(CheckCXXCompilerFlag)
 include(GenerateExportHeader)
@@ -57,12 +39,6 @@ include(GenerateExportHeader)
 #  and now the platform specific stuff
 ######################################################
 
-# Set a default build type for single-configuration
-# CMake generators if no build type is set.
-if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
-   set(CMAKE_BUILD_TYPE RelWithDebInfo)
-endif()
-
 
 if (WIN32)
 
@@ -169,10 +145,6 @@ endif (CMAKE_SYSTEM_NAME MATCHES Linux OR CMAKE_SYSTEM_NAME STREQUAL GNU)
 # compiler specific settings
 ############################################################
 
-if (CMAKE_BUILD_TYPE)
-  set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "DebugFull" "Release" "RelWithDebInfo" "Profile" "Coverage")
-endif()
-
 if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR (WIN32 AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel"))
 
    # this macro is for internal use only.
@@ -235,24 +207,6 @@ endif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
 if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
 # TODO: why do the other KDE_ENABLE_EXCEPTIONS not have -UQT_NO_EXCEPTIONS ?
    set (KDE_ENABLE_EXCEPTIONS "-fexceptions -UQT_NO_EXCEPTIONS")
-   # Select flags.
-   set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG -DQT_NO_DEBUG")
-   set(CMAKE_CXX_FLAGS_RELEASE        "-O2 -DNDEBUG -DQT_NO_DEBUG")
-   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_CXX_FLAGS_COVERAGE       "${CMAKE_CXX_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage")
-   set(CMAKE_C_FLAGS_RELWITHDEBINFO   "-O2 -g -DNDEBUG -DQT_NO_DEBUG")
-   set(CMAKE_C_FLAGS_RELEASE          "-O2 -DNDEBUG -DQT_NO_DEBUG")
-   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")
-   set(CMAKE_C_FLAGS_COVERAGE         "${CMAKE_C_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage")
-
-   # TODO: do those flags also apply to the Intel compiler ? What about clang ?
-   set(CMAKE_EXE_LINKER_FLAGS_COVERAGE "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
-   set (CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
-   set (CMAKE_MODULE_LINKER_FLAGS_PROFILE "${CMAKE_MODULE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
 
    set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} -Wno-long-long -std=iso9899:1990 -Wundef -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common")
    # As of Qt 4.6.x we need to override the new exception macros if we want compile with -fno-exceptions
@@ -304,24 +258,6 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
    # The generated code will be slightly bigger, but there is no way to avoid
    # it.
    set (KDE_ENABLE_EXCEPTIONS "-fexceptions -UQT_NO_EXCEPTIONS")
-   # Select flags.
-   set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG -DQT_NO_DEBUG")
-   set(CMAKE_CXX_FLAGS_RELEASE        "-O2 -DNDEBUG -DQT_NO_DEBUG")
-   set(CMAKE_CXX_FLAGS_DEBUG          "-g -O2 -fno-inline")
-   set(CMAKE_CXX_FLAGS_DEBUGFULL      "-g3 -fno-inline")
-   set(CMAKE_CXX_FLAGS_PROFILE        "-g3 -fno-inline -ftest-coverage -fprofile-arcs")
-   set(CMAKE_CXX_FLAGS_COVERAGE       "${CMAKE_CXX_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage")
-   set(CMAKE_C_FLAGS_RELWITHDEBINFO   "-O2 -g -DNDEBUG -DQT_NO_DEBUG")
-   set(CMAKE_C_FLAGS_RELEASE          "-O2 -DNDEBUG -DQT_NO_DEBUG")
-   set(CMAKE_C_FLAGS_DEBUG            "-g -O2 -fno-inline")
-   set(CMAKE_C_FLAGS_DEBUGFULL        "-g3 -fno-inline")
-   set(CMAKE_C_FLAGS_PROFILE          "-g3 -fno-inline -ftest-coverage -fprofile-arcs")
-   set(CMAKE_C_FLAGS_COVERAGE         "${CMAKE_C_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage")
-
-   # TODO: do those flags also apply to the Intel compiler?
-   set(CMAKE_EXE_LINKER_FLAGS_COVERAGE "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
-   set (CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
-   set (CMAKE_MODULE_LINKER_FLAGS_PROFILE "${CMAKE_MODULE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
 
    set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} -Wno-long-long -std=iso9899:1990 -Wundef -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -Wnon-virtual-dtor -Wno-long-long -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wformat-security -Woverloaded-virtual -fno-common -Werror=return-type")
@@ -344,15 +280,6 @@ endif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
 if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
 
    set (KDE_ENABLE_EXCEPTIONS -fexceptions)
-   # Select flags.
-   set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
-   set(CMAKE_CXX_FLAGS_RELEASE        "-O2 -DNDEBUG -DQT_NO_DEBUG")
-   set(CMAKE_CXX_FLAGS_DEBUG          "-O2 -g -fno-inline -noalign")
-   set(CMAKE_CXX_FLAGS_DEBUGFULL      "-g -fno-inline -noalign")
-   set(CMAKE_C_FLAGS_RELWITHDEBINFO   "-O2 -g")
-   set(CMAKE_C_FLAGS_RELEASE          "-O2 -DNDEBUG -DQT_NO_DEBUG")
-   set(CMAKE_C_FLAGS_DEBUG            "-O2 -g -fno-inline -noalign")
-   set(CMAKE_C_FLAGS_DEBUGFULL        "-g -fno-inline -noalign")
 
    set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS}   -Wall -w1 -Wpointer-arith -fno-common")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -Wall -w1 -Wpointer-arith -fno-exceptions -fno-common")


More information about the Kde-frameworks-devel mailing list