aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2020-04-16 11:24:19 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2020-04-16 11:24:19 +0200
commit1143dfb9cde844325f0ffdb3796ba187c2242376 (patch)
treef123620c930c5867c0084eaa62cf7063482f76d6
parent2e38681cd0b34e1ce36a6417445f3a7ca75f246c (diff)
downloadlibnitrokey-1143dfb9cde844325f0ffdb3796ba187c2242376.tar.gz
libnitrokey-1143dfb9cde844325f0ffdb3796ba187c2242376.tar.bz2
Add size optimization flag to debug and release configs
-rw-r--r--CMakeLists.txt7
1 files changed, 7 insertions, 0 deletions
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)