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 = [