diff options
| author | Alex Merry <kde@randomguy3.me.uk> | 2014-01-03 12:14:09 +0000 | 
|---|---|---|
| committer | Alex Merry <kde@randomguy3.me.uk> | 2014-01-07 19:12:22 +0000 | 
| commit | 4068592ad9aa3f241027f6dbd6aff5f756671fd3 (patch) | |
| tree | 8df0c616d305c4903cbb7dbaf6d0916b73af0b73 | |
| parent | f653fe3656e39e403d2079a8adde08ae76d380c2 (diff) | |
| download | extra-cmake-modules-4068592ad9aa3f241027f6dbd6aff5f756671fd3.tar.gz extra-cmake-modules-4068592ad9aa3f241027f6dbd6aff5f756671fd3.tar.bz2 | |
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@kde.org
REVIEW: 114885
| -rw-r--r-- | kde-modules/KDECompilerSettings.cmake | 87 | 
1 files changed, 7 insertions, 80 deletions
| diff --git a/kde-modules/KDECompilerSettings.cmake b/kde-modules/KDECompilerSettings.cmake index 72824e16..cb255f67 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") | 
