From 3c49517b767dc8f4b7dfeab88dcc5c63cf63681d Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Mon, 19 Dec 2022 13:06:00 +0100 Subject: [PATCH] Disable LTO in CI build with old gcc --- CMakeLists.txt | 14 ++++++++++---- nix/rt.nix | 3 +++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 488c85c..50ec5c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,10 +36,16 @@ include(CheckIPOSupported) check_ipo_supported(RESULT ipo_available OUTPUT error LANGUAGES C) # Enable IPO by default, if available -if(ipo_available) - set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) -else() - message(WARNING "IPO is not supported, expect performance penalty") +if(NOT DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION) + if(ipo_available) + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) + else() + message(WARNING "IPO is not supported, disabling") + endif() +endif() + +if(NOT CMAKE_INTERPROCEDURAL_OPTIMIZATION) + message(WARNING "IPO is not enabled, expect performance penalty") endif() # Extra build type for AddressSanitizer (Asan) diff --git a/nix/rt.nix b/nix/rt.nix index c1a3d6c..c829bbd 100644 --- a/nix/rt.nix +++ b/nix/rt.nix @@ -92,6 +92,9 @@ let stdenv = stdenv; }).overrideAttrs (old: { pname = old.name + "@" + stdenv.cc.cc.version; + cmakeFlags = old.cmakeFlags ++ [ + "-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF" + ]; }); oldCompilers = [