FortranCInterface: Restore mangling detection for NAG Fortran

Since commit cb616d43d6 (FortranCInterface: Fix failure with gfortran 12
and Clang, 2022-05-16, v3.23.2~10^2) we add LTO flags for C symbols when
using the GNU C compiler.  However, they are only needed when detecting
mangling of the GNU Fortran compiler, as was originally written in
commit 6a0ce19ce1 (FortranCInterface: Fix compatibility with GCC
gfortran 12 LTO, 2022-01-19, v3.22.2~5^2).

Fixes: #28008
This commit is contained in:
Brad King
2026-08-04 09:41:13 -04:00
parent 1704cd267e
commit 1c84ea4953

View File

@@ -127,12 +127,10 @@ if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND
target_compile_options(FortranCInterface PRIVATE "-fno-lto")
if(NOT APPLE)
target_compile_options(myfort PRIVATE "-flto=auto" "-ffat-lto-objects")
endif()
endif()
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND
CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12)
if(NOT APPLE)
target_compile_options(symbols PRIVATE "-flto=auto" "-ffat-lto-objects")
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND
CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12)
target_compile_options(symbols PRIVATE "-flto=auto" "-ffat-lto-objects")
endif()
endif()
endif()