$NetBSD: patch-Modules_FortranCInterface_CMakeLists.txt,v 1.1 2023/08/09 06:45:06 tnn 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 2023-07-25 17:58:09.000000000 +0000 +++ Modules/FortranCInterface/CMakeLists.txt @@ -113,11 +113,11 @@ target_link_libraries(FortranCInterface 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") + target_compile_options(myfort PRIVATE "-fno-lto") 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") + target_compile_options(symbols PRIVATE "-fno-lto") endif() file(GENERATE OUTPUT exe-$.cmake CONTENT [[