From 9cdcd16e82efc13c32726d3a5af930b07bc861a8 Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Tue, 6 Aug 2024 10:00:51 +0200 Subject: [PATCH] cmake: Do not attempt to use -fstack-clash-protection on MacOS M1 chips This is supported in clang, but only on x86_64 so we need to back down to the architecture checks. Otherwise the checks pass with warning, but the build itself fails with errors (-Werror). Signed-off-by: Jakub Jelen Reviewed-by: Andreas Schneider (cherry picked from commit dc18b413579feb54ddf8fd6e0bbf48e4e9487ccd) --- CompilerChecks.cmake | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/CompilerChecks.cmake b/CompilerChecks.cmake index 9719e699..e9890e2f 100644 --- a/CompilerChecks.cmake +++ b/CompilerChecks.cmake @@ -92,9 +92,12 @@ if (UNIX) endif (WITH_STACK_PROTECTOR_STRONG) if (NOT WINDOWS AND NOT CYGWIN) - check_c_compiler_flag_ssp("-fstack-clash-protection" WITH_STACK_CLASH_PROTECTION) - if (WITH_STACK_CLASH_PROTECTION) - list(APPEND SUPPORTED_COMPILER_FLAGS "-fstack-clash-protection") + # apple m* chips do not support this option + if (NOT ${CMAKE_SYSTEM_PROCESSOR} STREQUAL arm64) + check_c_compiler_flag_ssp("-fstack-clash-protection" WITH_STACK_CLASH_PROTECTION) + if (WITH_STACK_CLASH_PROTECTION) + list(APPEND SUPPORTED_COMPILER_FLAGS "-fstack-clash-protection") + endif() endif() endif()