From 1143dfb9cde844325f0ffdb3796ba187c2242376 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Thu, 16 Apr 2020 11:24:19 +0200 Subject: Add size optimization flag to debug and release configs --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1169e94..82cd251 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,6 +29,13 @@ set(CMAKE_CXX_EXTENSIONS OFF) include(GNUInstallDirs) +set(ADD_FLAGS "-Os -s -fno-rtti") +IF(CMAKE_COMPILER_IS_GNUCC) + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") + set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${ADD_FLAGS}") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${ADD_FLAGS}") + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${ADD_FLAGS}") +ENDIF(CMAKE_COMPILER_IS_GNUCC) IF (NOT CMAKE_BUILD_TYPE) -- cgit v1.2.3