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()
if (POLICY CMP0069)
option(TD_ENABLE_LTO "Use \"ON\" to enable Link Time Optimization.")
if (TD_ENABLE_LTO)
cmake_policy(SET CMP0069 NEW)
include(CheckIPOSupported)
check_ipo_supported(RESULT IPO_SUPPORTED)
@ -25,6 +28,7 @@ if (POLICY CMP0069)
message(STATUS "Use link time optimizations: ${CXX_FLAGS_IPO}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${CXX_FLAGS_IPO}")
endif()
endif()
endif()
# Configure CCache if available