$NetBSD: patch-Modules_FortranCInterface_CMakeLists.txt,v 1.2 2024/07/04 06:06:22 adam Exp $

Don't attempt to use LTO with GCC 12 when building Fortran code.
It breaks FortranCInterface (math/lapack and others) when the compiler
lacks working LTO support. Such as with lang/gcc12 from pkgsrc.
Upstream PR about the problem:
https://gitlab.kitware.com/cmake/cmake/-/issues/23525

--- Modules/FortranCInterface/CMakeLists.txt.orig	2024-07-02 14:40:35.000000000 +0000
+++ Modules/FortranCInterface/CMakeLists.txt
@@ -114,13 +114,13 @@ if(CMAKE_Fortran_COMPILER_ID STREQUAL "G
   CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 12)
   target_compile_options(FortranCInterface PRIVATE "-fno-lto")
   if(NOT APPLE)
-    target_compile_options(myfort PRIVATE "-flto=auto" "-ffat-lto-objects")
+    target_compile_options(myfort PRIVATE "-fno-lto")
   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")
+    target_compile_options(symbols PRIVATE "-fno-lto")
   endif()
 endif()
 
