enable LTO

Signed-off-by: James Cherry <cherry@parallaxsw.com>
This commit is contained in:
James Cherry 2026-02-03 11:32:15 -07:00
parent 78f579400c
commit 98d0f5605e
1 changed files with 10 additions and 0 deletions

View File

@ -63,6 +63,16 @@ message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
message(STATUS "Build CXX_FLAGS: ${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}}")
message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")
# Enable Link-Time Optimization (LTO) for Release builds.
include(CheckIPOSupported)
check_ipo_supported(RESULT ipo_supported OUTPUT ipo_error)
if(ipo_supported)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE)
message(STATUS "IPO/LTO: enabled for Release builds")
else()
message(STATUS "IPO/LTO: not supported - ${ipo_error}")
endif()
################################################################
#
# Source files.