From 907a5aef3b89fe01cd6cb15105435f3b5c7de85f Mon Sep 17 00:00:00 2001 From: Luis Diaz Date: Tue, 8 Oct 2019 17:10:28 +0200 Subject: [PATCH] clang guard for -fstack-protector-strong --- cmake/compilerFlags.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmake/compilerFlags.cmake b/cmake/compilerFlags.cmake index f185f8ba..46d6012d 100644 --- a/cmake/compilerFlags.cmake +++ b/cmake/compilerFlags.cmake @@ -39,9 +39,12 @@ if ( MINGW OR UNIX OR MSYS ) # MINGW, Linux, APPLE, CYGWIN endif() add_compile_options(-Wall -Wcast-align -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Woverloaded-virtual -W) - add_compile_options(-fstack-protector-strong) add_compile_options(-fasynchronous-unwind-tables) + if (COMPILER_IS_GCC OR (COMPILER_IS_CLANG AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 3.7 )) + # is not available for clang 3.4.2. it appears to be present in clang 3.7. + add_compile_options(-fstack-protector-strong) + endif() if ( EXIV2_TEAM_USE_SANITIZERS ) # ASAN is available in gcc from 4.8 and UBSAN from 4.9