From e248379d76804eb6e512053192acaa0a5e898f84 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Fri, 15 Jan 2016 20:11:57 -1000 Subject: [PATCH] Enable LTO for OS X Release builds --- CMakeLists.txt | 10 +++++++++- hecl | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ca031d50..8596c0851 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,13 +20,21 @@ else() endif() 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() if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") include_directories(/usr/local/include) 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) else() option(USE_LD_GOLD "Link with GNU Gold and enable LTO" OFF) diff --git a/hecl b/hecl index f2dff4f92..c964328bd 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit f2dff4f92b9da4ea4d99478a56a6697a91851713 +Subproject commit c964328bd3c286e6d87d1375549103777045fad8