X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=cmake%2FQuasselCompileSettings.cmake;h=014d4b3026eeb60205830e25640ea98f2bfb8931;hp=2e5d592e134ca684855c6e5b36b4d9c437ec8a28;hb=HEAD;hpb=07c41b7cebcc87a313a5bfccd50a7949d126180a diff --git a/cmake/QuasselCompileSettings.cmake b/cmake/QuasselCompileSettings.cmake index 2e5d592e..f2747df3 100644 --- a/cmake/QuasselCompileSettings.cmake +++ b/cmake/QuasselCompileSettings.cmake @@ -1,6 +1,6 @@ # This file contains compile flags and general build configuration for Quassel # -# (C) 2014-2018 by the Quassel Project +# (C) 2014-2022 by the Quassel Project # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. @@ -34,7 +34,6 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") -fdiagnostics-color=always -fexceptions -fno-common - -fstack-protector-strong -Wall -Wextra -Wcast-align @@ -46,10 +45,16 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") -Wvla -Werror=return-type "$<$:-Werror>" + -Wno-error=deprecated-declarations # Don't break on Qt upgrades -Wno-unknown-pragmas "$<$>:-U_FORTIFY_SOURCE;-D_FORTIFY_SOURCE=2>" ) + # ssp is currently very broken on MinGW + if(NOT MINGW) + add_compile_options(-fstack-protector-strong) + endif() + # Check for and set linker flags check_and_set_linker_flag("-Wl,-z,relro" RELRO LINKER_FLAGS) check_and_set_linker_flag("-Wl,-z,now" NOW LINKER_FLAGS) @@ -76,18 +81,19 @@ elseif(MSVC) # Increase warning level on MSVC # CMake puts /W3 in CMAKE_CXX_FLAGS which will be appended later, so we need to replace - message(STATUS "CXX ${CMAKE_CXX_FLAGS} REL ${CMAKE_CXX_FLAGS_RELEASE} DEB ${CMAKE_CXX_FLAGS_DEBUG}") string(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - # Silence annoying/useless warnings - # C4127: conditional expression is constant + # Silence warnings that are hard or impossible to avoid + # C4127: conditional expression is constant [in qvector.h as of Qt 5.15.2] set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4127") - # C4244: 'identifier': conversion from 't1' to 't2', possible loss of data - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244") - # C4456: declaration of 'identifier' hides previous local declaration + # C4456: declaration of 'identifier' hides previous local declaration [caused by foreach macro, among others] set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4456") - # C4458: declaration of 'identifier' hides class member + # C4458: declaration of 'identifier' hides class member [caused by MOC for Peer::_id] set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4458") + # C4996: deprecation warnings [unavoidable due to wide range of supported Qt versions] + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4996") + # C5240: 'nodiscard': attribute is ignored in this syntactic position [in qcolor.h as of Qt 5.15.2] + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd5240") # Link against the correct version of the C runtime set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/NODEFAULTLIB:libcmt /DEFAULTLIB:msvcrt ${CMAKE_EXE_LINKER_FLAGS_RELEASE}")