only use -mtune=generic on x86/amd64 #146

This flags breaks the build on e.g. ARM, so only use it when a PC
architecture (x86 or amd64) has been detected. Thanks to ZachBacon for
spotting this.
This commit is contained in:
Rafael Kitover 2017-08-30 14:42:08 -07:00
parent 350619be93
commit 8b2e8f87d4
1 changed files with 7 additions and 2 deletions

View File

@ -311,10 +311,15 @@ IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL Clang)
# common optimization flags
IF(NOT (APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL Clang AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.3))
SET(MY_C_OPT_FLAGS -O2 -mtune=generic -fomit-frame-pointer ${LTO_FLAG})
SET(MY_C_OPT_FLAGS -O2 -fomit-frame-pointer ${LTO_FLAG})
ELSE()
# LTO and -fomit-frame-pointer generate broken binaries on Lion with XCode 4.2 tools
SET(MY_C_OPT_FLAGS -O2 -mtune=generic)
SET(MY_C_OPT_FLAGS -O2)
ENDIF()
# only use -mtune=generic on PC architectures
IF(X86_32 OR AMD64)
SET(MY_C_OPT_FLAGS ${MY_C_OPT_FLAGS} -mtune=generic)
ENDIF()
# common debug flags