LLVMFlang: Enable ThinLTO support

Fixes: #27839
This commit is contained in:
Kelvin Li
2026-05-15 15:32:40 -04:00
committed by Brad King
parent dac8665889
commit 9573345dec

View File

@@ -35,3 +35,16 @@ endif()
set(CMAKE_SHARED_LIBRARY_Fortran_FLAGS -fPIC)
set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-shared")
# Determine LTO support
set(_CMAKE_Fortran_IPO_SUPPORTED_BY_CMAKE NO)
set(_CMAKE_Fortran_IPO_MAY_BE_SUPPORTED_BY_COMPILER NO)
if(CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 18.0)
set(_CMAKE_Fortran_IPO_SUPPORTED_BY_CMAKE YES)
set(_CMAKE_Fortran_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES)
if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 23.0)
set(CMAKE_Fortran_COMPILE_OPTIONS_IPO "-flto")
else()
set(CMAKE_Fortran_COMPILE_OPTIONS_IPO "-flto=thin")
endif()
endif()