Enable LTO for OS X Release builds

This commit is contained in:
Jack Andersen 2016-01-15 20:11:57 -10:00
parent 972b76279f
commit e248379d76
2 changed files with 10 additions and 2 deletions

View File

@ -20,13 +20,21 @@ else()
endif() endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wno-multichar -fno-exceptions") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wno-multichar -fno-exceptions")
if(APPLE)
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -flto")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -flto")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -flto")
endif()
endif() endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
include_directories(/usr/local/include) include_directories(/usr/local/include)
endif() endif()
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release" AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") if(("${CMAKE_BUILD_TYPE}" STREQUAL "Release" OR "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
option(USE_LD_GOLD "Link with GNU Gold and enable LTO" ON) option(USE_LD_GOLD "Link with GNU Gold and enable LTO" ON)
else() else()
option(USE_LD_GOLD "Link with GNU Gold and enable LTO" OFF) option(USE_LD_GOLD "Link with GNU Gold and enable LTO" OFF)

2
hecl

@ -1 +1 @@
Subproject commit f2dff4f92b9da4ea4d99478a56a6697a91851713 Subproject commit c964328bd3c286e6d87d1375549103777045fad8