diff --git a/CMakeLists.txt b/CMakeLists.txt index c22408b72..04adcc66d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2520,18 +2520,30 @@ endif() # Processor-architecture related flags # See https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32) + if(NOT ENABLE_GENERIC_ARCH) + if(IS_ARM) + # ARM-specific options + # See https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html + if(NOT CMAKE_CROSSCOMPILING AND NOT CMAKE_TOOLCHAIN_FILE) + add_compile_options(-mtune=native) + endif() + else() + add_compile_options(-march=native) + endif() + endif() +endif() +if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") if(NOT ENABLE_GENERIC_ARCH) if(OS_IS_MACOSX) - add_compile_options(-march=corei7 -mfpmath=sse) + add_compile_options(-march=native) else() if(IS_ARM) # ARM-specific options - # See https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html if(NOT CMAKE_CROSSCOMPILING AND NOT CMAKE_TOOLCHAIN_FILE) add_compile_options(-mcpu=native) endif() else() - add_compile_options(-march=native -mfpmath=sse) + add_compile_options(-march=native) endif() endif() endif()