Add compiler flags for clang

This commit is contained in:
Carles Fernandez 2019-11-01 23:05:31 +01:00
parent 75c2dcc929
commit 87974a9456
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
1 changed files with 15 additions and 3 deletions

View File

@ -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()