From 1c84ea4953ca82d0bde7f1b1cbb73c395f7db6d5 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 4 Aug 2026 09:41:13 -0400 Subject: [PATCH] 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 --- Modules/FortranCInterface/CMakeLists.txt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Modules/FortranCInterface/CMakeLists.txt b/Modules/FortranCInterface/CMakeLists.txt index cabbb32b6a..af18da1f0c 100644 --- a/Modules/FortranCInterface/CMakeLists.txt +++ b/Modules/FortranCInterface/CMakeLists.txt @@ -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()