From ef06b6749e882132dd86d33945d234ff0c16120b Mon Sep 17 00:00:00 2001 From: Marcus Holland-Moritz Date: Tue, 9 Mar 2021 12:07:00 +0100 Subject: [PATCH] Use -O2 for gcc by default (fixes github #14) --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 36fc0b35..4986b13a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,6 +44,9 @@ endif() if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") add_compile_options(-fdiagnostics-color=always) + # For gcc, -O3 is *much* worse than -O2 + set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -O2 -g") + set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O2 -g") elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") add_compile_options(-fcolor-diagnostics) endif()