diff options
| -rw-r--r-- | kde-modules/KDECompilerSettings.cmake | 32 | 
1 files changed, 19 insertions, 13 deletions
| diff --git a/kde-modules/KDECompilerSettings.cmake b/kde-modules/KDECompilerSettings.cmake index 62ba4a0a..92d1f823 100644 --- a/kde-modules/KDECompilerSettings.cmake +++ b/kde-modules/KDECompilerSettings.cmake @@ -94,10 +94,12 @@ endif()  # Pick sensible versions of the C and C++ standards  # FIXME: MSVC, Intel on windows? -if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") +if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")      # We use the C89 standard because that is what is common to all our      # compilers (in particular, MSVC 2010 does not support C99)      set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} -std=iso9899:1990") +endif() +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")  elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" AND NOT WIN32)      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") @@ -108,9 +110,9 @@ endif()  # 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)) +if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR +        "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR +        ("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel" AND NOT WIN32))      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-common")  endif() @@ -252,20 +254,24 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR      set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_MODULE_LINKER_FLAGS}")  endif() +set(_KDE_GCC_COMMON_WARNING_FLAGS "-Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef") +if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") +    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_KDE_GCC_COMMON_WARNING_FLAGS} -Wmissing-format-attribute -Wwrite-strings") +    # Make some warnings errors +    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=implicit-function-declaration") +endif()  if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") -    set(_KDE_COMMON_WARNING_FLAGS "-Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef") -    set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} ${_KDE_COMMON_WARNING_FLAGS} -Wmissing-format-attribute -Wwrite-strings") -    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_KDE_COMMON_WARNING_FLAGS} -Wnon-virtual-dtor -Woverloaded-virtual") - +    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_KDE_GCC_COMMON_WARNING_FLAGS} -Wnon-virtual-dtor -Woverloaded-virtual")      # Make some warnings errors -    set (CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} -Werror=implicit-function-declaration") -    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=return-type") +    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=return-type")  endif() +# -w1 turns on warnings and errors +# FIXME: someone needs to have a closer look at the Intel compiler options +if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel" AND NOT WIN32) +    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -w1 -Wpointer-arith") +endif()  if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" AND NOT WIN32) -    # -w1 turns on warnings and errors -    # FIXME: someone needs to have a closer look at the Intel compiler options -    set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS}   -Wall -w1 -Wpointer-arith")      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -w1 -Wpointer-arith")  endif() | 
