From 47b1804034d3928e874abdc4a85d8e3c5686ac43 Mon Sep 17 00:00:00 2001 From: Stefan Wunsch Date: Sat, 6 Mar 2021 12:37:44 +0100 Subject: [PATCH] [cmake] Enable mcpu=native for all Arm processors (#6156) --- ProcessorTargets.cmake | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/ProcessorTargets.cmake b/ProcessorTargets.cmake index a752dceeb..b22cfc839 100644 --- a/ProcessorTargets.cmake +++ b/ProcessorTargets.cmake @@ -7,13 +7,8 @@ set(PROC_TARGET_1_FLAGS "-mtune=generic" CACHE STRING "Processor-1 flags") # This second choice should be used for your own build only set(PROC_TARGET_2_LABEL native CACHE STRING "Processor-2 label - use it for your own build") -# Get the architecture on an Apple system (x86 or arm64) -if(APPLE) - execute_process(COMMAND uname -m OUTPUT_VARIABLE APPLE_ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE) -endif() - -# On Apple's M1 processor and with Apple's clang compiler, the native flag is different -if(CMAKE_CXX_COMPILER_ID STREQUAL AppleClang AND APPLE_ARCHITECTURE STREQUAL arm64) +# The flag is different on x86 and Arm based processors +if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL arm64) set(PROC_TARGET_2_FLAGS "-mcpu=native" CACHE STRING "Processor-2 flags") else() set(PROC_TARGET_2_FLAGS "-march=native" CACHE STRING "Processor-2 flags")