From 0f3bda4c4490f9fd836090747112f3b00912ae0a Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Mon, 18 Dec 2017 08:50:12 +0100 Subject: [PATCH] Compile with -O2 optimization even in debug mode The -O0 default is useless owing to extremely convoluted assembly. Moreover, many warnings depending on data analysis are ineffective with -O0. Signed-off-by: Berthold Stoeger --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index e8d9b9e87..650b0d43b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,6 +100,10 @@ endif() set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") +# optimize -O2 even for debug builds +set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O2") +set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O2") + # pkgconfig for required libraries find_package(PkgConfig) include(cmake/Modules/pkgconfig_helper.cmake)