CMake: Make LTO default off, restrict to release build
Link Time Optimizations increases build time a lot so restrict this optimization to release builds. Follow our build bots and make this option default off. Also LTO requires CMake >= 3.9 so make the LTO CMake option universally conditional on that requirement.
This commit is contained in:
parent
925e01b23f
commit
3467b98eb7
|
@ -73,8 +73,8 @@ if (ENABLE_LTO)
|
|||
include(CheckIPOSupported)
|
||||
check_ipo_supported(RESULT lto_supported OUTPUT lto_output)
|
||||
if(lto_supported)
|
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||
message(STATUS "LTO/IPO is enabled")
|
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE)
|
||||
message(STATUS "LTO/IPO is enabled for Release configuration")
|
||||
else()
|
||||
message(STATUS "LTO/IPO requested but it is not supported by the compiler: ${lto_output}")
|
||||
endif()
|
||||
|
|
|
@ -63,10 +63,8 @@ else()
|
|||
option(ENABLE_COMPILER_COLOR_DIAGNOSTICS "Always enable the compiler's color diagnostic output" OFF)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
option(ENABLE_LTO "Improves performance using Link Time Optimization" ON)
|
||||
elseif(CMAKE_VERSION VERSION_GREATER "3.8.99")
|
||||
option(ENABLE_LTO "Improves performance using Link Time Optimization" OFF)
|
||||
if(CMAKE_VERSION VERSION_GREATER "3.8.99")
|
||||
option(ENABLE_LTO "Use Link Time Optimization (release configuration only)" OFF)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
|
|
Loading…
Reference in New Issue