From cff46f99ee1b6a7b647d858f5af27f9c7e6a539e Mon Sep 17 00:00:00 2001 From: Aditya Kamath Date: Mon, 24 Aug 2026 05:12:49 -0500 Subject: [PATCH] AIX: Disable LTO/IPO with GCC, which does not support it The GNU compiler does not support LTO on AIX. --- Modules/Compiler/GNU.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake index 141838e94c..e4cccb7a4f 100644 --- a/Modules/Compiler/GNU.cmake +++ b/Modules/Compiler/GNU.cmake @@ -77,7 +77,8 @@ macro(__compiler_gnu lang) # '-flto' introduced since GCC 4.5: # * https://gcc.gnu.org/onlinedocs/gcc-4.4.7/gcc/Option-Summary.html (no) # * https://gcc.gnu.org/onlinedocs/gcc-4.5.4/gcc/Option-Summary.html (yes) - if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4.5) + # * It does not support AIX. + if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4.5 AND NOT CMAKE_SYSTEM_NAME STREQUAL "AIX") set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES) set(__lto_flags "")