Meta: Add an option to disable LTO for Release builds

This commit is contained in:
Ali Mohammad Pur 2025-04-06 20:37:03 +02:00 committed by Ali Mohammad Pur
commit 0a958c8e16
Notes: github-actions[bot] 2025-04-08 12:02:37 +00:00
2 changed files with 9 additions and 6 deletions

View file

@ -38,6 +38,7 @@ elseif (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
else()
add_cxx_compile_options(-O3)
if (ENABLE_LTO_FOR_RELEASE)
include(CheckIPOSupported)
check_ipo_supported(RESULT IPO_AVAILABLE OUTPUT output)
if(IPO_AVAILABLE)
@ -46,6 +47,7 @@ else()
message(WARNING "Not enabling IPO as it is not supported: ${output}")
endif()
endif()
endif()
function(add_cxx_linker_flag_if_supported flag)
include(CheckLinkerFlag)

View file

@ -14,6 +14,7 @@ serenity_option(LAGOM_TOOLS_ONLY OFF CACHE BOOL "Don't build libraries, utilitie
serenity_option(ENABLE_LAGOM_CCACHE ON CACHE BOOL "Enable ccache for Lagom builds")
serenity_option(LAGOM_USE_LINKER "" CACHE STRING "The linker to use (e.g. lld, mold) instead of the system default")
serenity_option(LAGOM_LINK_POOL_SIZE "" CACHE STRING "The maximum number of parallel jobs to use for linking")
serenity_option(ENABLE_LTO_FOR_RELEASE ON CACHE BOOL "Enable link-time optimization for release builds")
serenity_option(ENABLE_LAGOM_COVERAGE_COLLECTION OFF CACHE STRING "Enable code coverage instrumentation for lagom binaries in clang")
if (ANDROID OR APPLE)