diff options
| -rw-r--r-- | kde-modules/KDECompilerSettings.cmake | 40 | ||||
| -rw-r--r-- | modules/ECMQtFramework.cmake | 56 | 
2 files changed, 31 insertions, 65 deletions
| diff --git a/kde-modules/KDECompilerSettings.cmake b/kde-modules/KDECompilerSettings.cmake index 328cd71b..603c1504 100644 --- a/kde-modules/KDECompilerSettings.cmake +++ b/kde-modules/KDECompilerSettings.cmake @@ -1,3 +1,14 @@ +# This module provides the following options: +#   KDE4_ENABLE_FPIE - if enabled, the KDE4_CXX_FPIE_FLAGS and KDE4_PIE_LDFLAGS variables is set accordingly +# +# This module provides the following variables: +#   KDE4_CXX_FPIE_FLAGS - the flag to be used for building PIE executables +#   KDE4_PIE_LDFLAGS - the flag to be used by linking PIE executables +#   KDE4_ENABLE_EXCEPTIONS - use this to enable exceptions +# +# This module also sets up CMAKE_CXX_FLAGS for a set of predefined buildtypes +# as documented below. +#  #  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: @@ -21,8 +32,8 @@  #  It's also important to note that gcc cannot detect all warning conditions  #  unless the optimiser is active. -  include(CheckCXXCompilerFlag) +include(GenerateExportHeader)  # Position-Independent-Executable is a feature of Binutils, Libc, and GCC that creates an executable  # which is something between a shared library and a normal executable. @@ -209,12 +220,6 @@ 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() -    # 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") @@ -229,13 +234,6 @@ if (CMAKE_SYSTEM_NAME MATCHES Linux OR CMAKE_SYSTEM_NAME STREQUAL GNU)        set ( CMAKE_SHARED_LINKER_FLAGS "-Wl,--enable-new-dtags -Wl,--fatal-warnings -Wl,--no-undefined -lc ${CMAKE_SHARED_LINKER_FLAGS}")        set ( CMAKE_MODULE_LINKER_FLAGS "-Wl,--enable-new-dtags -Wl,--fatal-warnings -Wl,--no-undefined -lc ${CMAKE_MODULE_LINKER_FLAGS}")        set ( CMAKE_EXE_LINKER_FLAGS    "-Wl,--enable-new-dtags ${CMAKE_EXE_LINKER_FLAGS}") - -      # we profile... -      if(CMAKE_BUILD_TYPE_TOLOWER MATCHES profile) -        # TODO: do those flags also apply to the Intel compiler ? -        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()     if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") @@ -256,6 +254,7 @@ endif (CMAKE_SYSTEM_NAME MATCHES BSD)  # compiler specific settings  ############################################################ +set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "DebugFull" "Release" "RelWithDebInfo" "Profile" "Coverage")  if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") @@ -313,6 +312,7 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")  #    set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES  #        ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES} ${_dirs}) +# TODO: why do the other KDE4_ENABLE_EXCEPTIONS not have -UQT_NO_EXCEPTIONS ?     set (KDE4_ENABLE_EXCEPTIONS "-fexceptions -UQT_NO_EXCEPTIONS")     # Select flags.     set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG -DQT_NO_DEBUG") @@ -320,11 +320,19 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")     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") +     if (CMAKE_SYSTEM_NAME MATCHES Linux OR CMAKE_SYSTEM_NAME STREQUAL GNU)       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") @@ -453,3 +461,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")  #   endif (__KDE_HAVE_ICC_VISIBILITY)  endif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") + +add_compiler_export_flags()  # from GenerateExportHeader.cmake + +add_definitions(${_KDE4_PLATFORM_DEFINITIONS}) diff --git a/modules/ECMQtFramework.cmake b/modules/ECMQtFramework.cmake index 991c4d4c..865f9059 100644 --- a/modules/ECMQtFramework.cmake +++ b/modules/ECMQtFramework.cmake @@ -82,7 +82,7 @@  # 15) The FeatureSummary module is included.  #  # 16) The CMAKE_LINK_INTERFACE_LIBRARIES variable is set to empty. This means that the library targets created -# will have an empty link interface unless the LINK_INTERFACE_LIBRARIES or the LINK_PUBLIC keyword  +# will have an empty link interface unless the LINK_INTERFACE_LIBRARIES or the LINK_PUBLIC keyword  # to target_link_libraries are used.  # We need to make sure this file is included before Qt found. @@ -94,33 +94,11 @@  include(FeatureSummary) -include(GenerateExportHeader) -add_compiler_export_flags() +include(${CMAKE_CURRENT_LIST_DIR}/../kde-modules/KDEInstallDirs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/../kde-modules/KDECMakeSettings.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/../kde-modules/KDECompilerSettings.cmake) -# This will only have an effect in CMake 2.8.7 -set(CMAKE_LINK_INTERFACE_LIBRARIES "") - -# create coverage build type -set(CMAKE_CONFIGURATION_TYPES ${CMAKE_CONFIGURATION_TYPES} Coverage) -if(${CMAKE_VERSION} VERSION_GREATER 2.8.2) -  set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS -                "Debug" "Release" "MinSizeRel" "RelWithDebInfo" "Coverage") -endif() - -if(CMAKE_COMPILER_IS_GNUCXX) -  set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage") -  set(CMAKE_C_FLAGS_COVERAGE "${CMAKE_C_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage") -  set(CMAKE_EXE_LINKER_FLAGS_COVERAGE "${CMAKE_EXE_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} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wformat-security -Wno-variadic-macros -fno-check-new -fno-common -pedantic-errors") - -  if(NOT APPLE) -    set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--fatal-warnings -Wl,--no-undefined ${CMAKE_SHARED_LINKER_FLAGS}") -    set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--fatal-warnings -Wl,--no-undefined ${CMAKE_MODULE_LINKER_FLAGS}") -  endif() -endif()  add_definitions(-DQT_NO_CAST_TO_ASCII)  add_definitions(-DQT_NO_CAST_FROM_ASCII) @@ -132,26 +110,6 @@ add_definitions(-DQT_USE_FAST_CONCATENATION)  add_definitions(-DQT_USE_FAST_OPERATOR_PLUS) -# Tell FindQt4.cmake to point the QT_QTFOO_LIBRARY targets at the imported targets -# for the Qt libraries, so we get full handling of release and debug versions of the -# Qt libs and are flexible regarding the install location of Qt under Windows -set(QT_USE_IMPORTED_TARGETS TRUE) - -# Always include the source and build directories in the include path -# to save doing so manually in every subdirectory. -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON) - -set(CMAKE_AUTOMOC ON) - -set(LIB_SUFFIX "" CACHE STRING "Define suffix of library directory name (eg. '64')") - -set(LIB_INSTALL_DIR lib${LIB_SUFFIX}) -set(BIN_INSTALL_DIR bin) -set(INCLUDE_INSTALL_DIR include) -set(DATA_INSTALL_DIR share) -  set(LIBRARY_TYPE SHARED)  set(ECM_TARGET_DEFAULT_ARGS @@ -161,11 +119,7 @@ set(ECM_TARGET_DEFAULT_ARGS    ARCHIVE DESTINATION ${LIB_INSTALL_DIR} COMPONENT ${PROJECT_NAME}  ) -# set up RPATH/install_name_dir -set(CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}) -set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) - -set(CMAKECONFIG_INSTALL_DIR "${LIB_INSTALL_DIR}/cmake/${PROJECT_NAME}") +set(CMAKECONFIG_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/${PROJECT_NAME}")  file(RELATIVE_PATH relInstallDir ${CMAKE_INSTALL_PREFIX}/${CMAKECONFIG_INSTALL_DIR} ${CMAKE_INSTALL_PREFIX}) | 
