summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-05-16 15:15:34 (GMT)
committerBrad King <brad.king@kitware.com>2022-05-16 15:18:00 (GMT)
commitcb616d43d6f0912f3b4ab61d210cebe42dbfffb3 (patch)
tree7abb9acd935026b94d887d94d6e7ccf06c87140e
parentd478dda0ebef377638636dab64bc062095426279 (diff)
downloadCMake-cb616d43d6f0912f3b4ab61d210cebe42dbfffb3.zip
CMake-cb616d43d6f0912f3b4ab61d210cebe42dbfffb3.tar.gz
CMake-cb616d43d6f0912f3b4ab61d210cebe42dbfffb3.tar.bz2
FortranCInterface: Fix failure with gfortran 12 and Clang
The C flags added by commit 6a0ce19ce1 (FortranCInterface: Fix compatibility with GCC gfortran 12 LTO, 2022-01-19, v3.22.2~5^2) should only be added for the GNU C compiler. Fixes: #23500 Issue: #23123
-rw-r--r--Modules/FortranCInterface/CMakeLists.txt3
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/FortranCInterface/CMakeLists.txt b/Modules/FortranCInterface/CMakeLists.txt
index ce0bc10..fb35ff0 100644
--- a/Modules/FortranCInterface/CMakeLists.txt
+++ b/Modules/FortranCInterface/CMakeLists.txt
@@ -112,6 +112,9 @@ if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND
CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 12)
target_compile_options(FortranCInterface PRIVATE "-fno-lto")
target_compile_options(myfort PRIVATE "-flto=auto" "-ffat-lto-objects")
+endif()
+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()