Disable LTO by default. Add CMake option TD_ENABLE_LTO to enable it.

GitOrigin-RevId: 53fd2d4573946bfac27c10953874f96b2e8491d1
This commit is contained in:
levlam 2018-02-18 00:27:57 +03:00
parent 33225f66ae
commit a17c3c7ca9

View File

@ -16,6 +16,9 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
enable_testing() enable_testing()
if (POLICY CMP0069) if (POLICY CMP0069)
option(TD_ENABLE_LTO "Use \"ON\" to enable Link Time Optimization.")
if (TD_ENABLE_LTO)
cmake_policy(SET CMP0069 NEW) cmake_policy(SET CMP0069 NEW)
include(CheckIPOSupported) include(CheckIPOSupported)
check_ipo_supported(RESULT IPO_SUPPORTED) check_ipo_supported(RESULT IPO_SUPPORTED)
@ -26,6 +29,7 @@ if (POLICY CMP0069)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${CXX_FLAGS_IPO}") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${CXX_FLAGS_IPO}")
endif() endif()
endif() endif()
endif()
# Configure CCache if available # Configure CCache if available
find_program(CCACHE_FOUND ccache) find_program(CCACHE_FOUND ccache)