Merge topic 'flang-ipo'

9573345dec LLVMFlang: Enable ThinLTO support

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12123
This commit is contained in:
Brad King
2026-06-02 13:23:57 +00:00
committed by Kitware Robot

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()