enable lto only for release builds

This commit is contained in:
Georg Hagen
2025-02-09 02:16:30 +01:00
parent e53b402a4c
commit b72962e27f

View File

@@ -1,12 +1,14 @@
include(CheckIPOSupported)
function(SetOptimisationSettings)
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()
if (LINUX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -mtune=native" PARENT_SCOPE)