only use -flto=10 with gcc

gcc allows flto=<jobs> to parallelize linking, clang does not understand
this, use just -flto for clang and -flto=10 for gcc.
This commit is contained in:
Rafael Kitover 2016-11-23 03:13:33 -08:00
parent 790c9e13bd
commit b468eddfa5
1 changed files with 7 additions and 1 deletions

View File

@ -291,8 +291,14 @@ ENDIF()
# Compiler flags
IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
IF(CMAKE_COMPILER_IS_GNUCXX)
SET(LTO_FLAG -flto=10)
ELSE()
SET(LTO_FLAG -flto)
ENDIF()
# common optimization flags
SET(MY_C_AND_CXX_OPT_FLAGS -O2 -mtune=generic -fomit-frame-pointer -flto=10)
SET(MY_C_AND_CXX_OPT_FLAGS -O2 -mtune=generic -fomit-frame-pointer ${LTO_FLAG})
# common debug flags
IF(CMAKE_COMPILER_IS_GNUCXX)