From 17c6f0079102d067bd9350cecd23a88ecd41e456 Mon Sep 17 00:00:00 2001 From: Patrick Brosi Date: Fri, 11 Oct 2024 14:50:35 +0200 Subject: [PATCH] use -flto instead of flto=auto for compilers other than GCC >= 12, as per suggestion of Axel --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4c8df65a..07370d96 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,8 +51,11 @@ add_compile_options(-Wall -Wextra -Wno-missing-field-initializers) add_compile_options(-DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=0) # Basic optimization -if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12) +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12) add_compile_options(-flto=auto) +else() + add_compile_options(-flto) + add_link_options(-flto) endif() add_compile_options(-march=native)