diff options
author | João Valverde <j@v6e.pt> | 2021-07-22 21:29:37 +0100 |
---|---|---|
committer | Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org> | 2021-07-26 15:13:38 +0000 |
commit | 3467b98eb72f8971c83b25b920419b8d0d49016a (patch) | |
tree | 6fd905a74275159e42c590ed480b14ad2d3a309c | |
parent | 925e01b23fd5aad2fa929fafd894128a88832e74 (diff) |
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.
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-rw-r--r-- | CMakeOptions.txt | 6 |
2 files changed, 4 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d6f2ac466..8ac3cf7e6a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/CMakeOptions.txt b/CMakeOptions.txt index 1beeb99f56..7296f16b01 100644 --- a/CMakeOptions.txt +++ b/CMakeOptions.txt @@ -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) |