From e6673465823a053eb1bf9dcb19ee93b56a704c79 Mon Sep 17 00:00:00 2001 From: Kevin Backhouse Date: Sat, 7 Aug 2021 16:57:40 +0100 Subject: [PATCH] Fix for https://github.com/Exiv2/exiv2/issues/1856 --- cmake/compilerFlags.cmake | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmake/compilerFlags.cmake b/cmake/compilerFlags.cmake index 8459fa0e..260c906e 100644 --- a/cmake/compilerFlags.cmake +++ b/cmake/compilerFlags.cmake @@ -31,10 +31,12 @@ if ( MINGW OR UNIX OR MSYS ) # MINGW, Linux, APPLE, CYGWIN if (COMPILER_IS_GCC OR COMPILER_IS_CLANG) - # This fails under Fedora - MinGW - Gcc 8.3 + # This fails under Fedora - MinGW - Gcc 8.3 and macOS/M1 if (NOT (MINGW OR CYGWIN OR CMAKE_HOST_SOLARIS)) - if (NOT APPLE) # Don't know why this isn't working correctly on Apple with M1 processor - check_cxx_compiler_flag(-fstack-clash-protection HAS_FSTACK_CLASH_PROTECTION) + # macOS M1 will set ARCHITECTURE == arm64 + EXECUTE_PROCESS( COMMAND uname -m COMMAND tr -d '\n' OUTPUT_VARIABLE ARCHITECTURE ) + if ( NOT ${ARCHITECTURE} STREQUAL arm64 ) + check_cxx_compiler_flag(-fstack-clash-protection HAS_FSTACK_CLASH_PROTECTION) endif() check_cxx_compiler_flag(-fcf-protection HAS_FCF_PROTECTION) check_cxx_compiler_flag(-fstack-protector-strong HAS_FSTACK_PROTECTOR_STRONG)