MinGW: don't use -fstack-protector

Mingw-w64 fails to link when using -fstack-protector flags, disabled the
flag check for non Unix system.
This commit is contained in:
Rui Abreu Ferreira
2015-10-14 00:46:32 +01:00
committed by Seth Jackson
parent 269f3ac779
commit 54a1fb77e7

View File

@@ -216,12 +216,16 @@ if(HAS_WVLA_FLAG)
add_definitions(-Wvla) add_definitions(-Wvla)
endif() endif()
check_c_compiler_flag(-fstack-protector-strong HAS_FSTACK_PROTECTOR_STRONG_FLAG) if(UNIX)
check_c_compiler_flag(-fstack-protector HAS_FSTACK_PROTECTOR_FLAG) # -fstack-protector breaks non Unix builds even in Mingw-w64
if(HAS_FSTACK_PROTECTOR_STRONG_FLAG) check_c_compiler_flag(-fstack-protector-strong HAS_FSTACK_PROTECTOR_STRONG_FLAG)
add_definitions(-fstack-protector-strong) check_c_compiler_flag(-fstack-protector HAS_FSTACK_PROTECTOR_FLAG)
elseif(HAS_FSTACK_PROTECTOR_FLAG)
add_definitions(-fstack-protector --param ssp-buffer-size=4) if(HAS_FSTACK_PROTECTOR_STRONG_FLAG)
add_definitions(-fstack-protector-strong)
elseif(HAS_FSTACK_PROTECTOR_FLAG)
add_definitions(-fstack-protector --param ssp-buffer-size=4)
endif()
endif() endif()
check_c_compiler_flag(-fdiagnostics-color=auto HAS_DIAG_COLOR_FLAG) check_c_compiler_flag(-fdiagnostics-color=auto HAS_DIAG_COLOR_FLAG)