From b72962e27f88e18c9aede0f4769af4699adc65a5 Mon Sep 17 00:00:00 2001 From: Georg Hagen Date: Sun, 9 Feb 2025 02:16:30 +0100 Subject: [PATCH] enable lto only for release builds --- cmake/functions/SetCompilerSettings.cmake | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cmake/functions/SetCompilerSettings.cmake b/cmake/functions/SetCompilerSettings.cmake index e4abd9f..da2cad7 100644 --- a/cmake/functions/SetCompilerSettings.cmake +++ b/cmake/functions/SetCompilerSettings.cmake @@ -1,10 +1,12 @@ include(CheckIPOSupported) function(SetOptimisationSettings) - if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - check_ipo_supported(RESULT result) - if(result) - set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE PARENT_SCOPE) + if(CMAKE_BUILD_TYPE STREQUAL "Release") + if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + check_ipo_supported(RESULT result) + if(result) + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE PARENT_SCOPE) + endif() endif() endif()