LLVMFlang: Enable ThinLTO support

Fixes: #27839
This commit is contained in:
Kelvin Li authored and Brad King committed 2026-06-01 15:28:01 -04:00
1 parent dac8665889
commit 9573345dec
1 file changed
+13
+13
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()