diff options
| author | Alex Merry <kde@randomguy3.me.uk> | 2014-01-28 16:39:10 +0000 | 
|---|---|---|
| committer | Alex Merry <kde@randomguy3.me.uk> | 2014-01-29 13:18:36 +0000 | 
| commit | 455483e482f9bcc861d20e178c3d2ba3223a22e0 (patch) | |
| tree | 027ac8e78c86f8b7f5f95de245cb7773c7722e5f /kde-modules | |
| parent | 4e867a836bafd113c6d4b34c17eeb564089308a2 (diff) | |
| download | extra-cmake-modules-455483e482f9bcc861d20e178c3d2ba3223a22e0.tar.gz extra-cmake-modules-455483e482f9bcc861d20e178c3d2ba3223a22e0.tar.bz2 | |
Move and comment -fno-common setting
REVIEW: 115363
Diffstat (limited to 'kde-modules')
| -rw-r--r-- | kde-modules/KDECompilerSettings.cmake | 23 | 
1 files changed, 11 insertions, 12 deletions
| diff --git a/kde-modules/KDECompilerSettings.cmake b/kde-modules/KDECompilerSettings.cmake index 6b94668b..bcc11284 100644 --- a/kde-modules/KDECompilerSettings.cmake +++ b/kde-modules/KDECompilerSettings.cmake @@ -103,6 +103,17 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" AND NOT WIN32)      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")  endif() +# Do not merge uninitialized global variables. +# This is mostly a "principle of least surprise" thing, but also +# has performance benefits. +# See https://www.ibm.com/developerworks/community/blogs/zTPF/entry/benefits_of_the_fnocommon_compile_option_peter_lemieszewski?lang=en +# Note that this only applies to C code; C++ already behaves like this. +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR +        "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR +        ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" AND NOT WIN32)) +    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-common") +endif() +  # Default to hidden visibility for symbols  set(CMAKE_CXX_VISIBILITY_PRESET hidden)  set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) @@ -292,11 +303,6 @@ endif()  ############################################################  if (APPLE) -    # FIXME: is this still needed? -    # Apple's Mach-O linker apparently does not like having uninitialized global -    # variables in a common block (only relevant for C code) -    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-common") -      # FIXME: why are these needed?      set (CMAKE_SHARED_LINKER_FLAGS "-single_module -multiply_defined suppress ${CMAKE_SHARED_LINKER_FLAGS}")      set (CMAKE_MODULE_LINKER_FLAGS "-multiply_defined suppress ${CMAKE_MODULE_LINKER_FLAGS}") @@ -318,10 +324,3 @@ if (MINGW AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")      set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--export-all-symbols")  endif() -if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR -        "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR -        ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" AND NOT WIN32)) -    # FIXME: why? -    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-common") -endif() - | 
