From 0ae10c404e42cf6d872e75ffa6135d16e61ee4b5 Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 5 Dec 2016 19:52:14 +0100 Subject: [PATCH] Changed: Display more warnings if using -fstack-protector --HG-- branch : develop --- code/CMakeModules/nel.cmake | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index b9967d386..96b33c648 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -939,6 +939,14 @@ MACRO(NL_SETUP_BUILD) # hardening ADD_PLATFORM_FLAGS("-fstack-protector --param=ssp-buffer-size=4") + # If -fstack-protector or -fstack-protector-all enabled, enable too new warnings and fix possible link problems + IF(WITH_WARNINGS) + ADD_PLATFORM_FLAGS("-Wstack-protector") + ENDIF() + + # Fix undefined reference to `__stack_chk_fail' error + ADD_PLATFORM_LINKFLAGS("-lc") + IF(NOT APPLE) ADD_PLATFORM_LINKFLAGS("-Wl,--no-undefined -Wl,--as-needed") ENDIF()