diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -132,9 +132,10 @@ # Enable stack protection add_cxx_compiler_flags(-fstack-protector-all -Wstack-protector) - # Enable some buffer overflow checking - add_compiler_flags(-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2) - + # Enable some buffer overflow checking (not supported without optimization) + if(NOT CMAKE_BUILD_TYPE MATCHES Debug) + add_compiler_flags(-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2) + endif() # Enable ASLR (these flags are primarily targeting MinGw) add_linker_flags(-Wl,--dynamicbase -Wl,--nxcompat -Wl,--high-entropy-va) @@ -203,10 +204,15 @@ if(ENABLE_WERROR) add_compiler_flags( - -Werror=return-type - -Werror=switch - -Werror=thread-safety-analysis - -Werror=vla + # turns warnings into errors + -Werror + # except for the following + -Wno-error=cast-align + -Wno-error=deprecated-copy + -Wno-error=deprecated-declarations + -Wno-error=implicit-int-float-conversion + -Wno-error=maybe-uninitialized + -Wno-error=stringop-truncation ) endif()