From ed251cfad23484794e02500f1e413b86eb58eb85 Mon Sep 17 00:00:00 2001
From: hhadjdji <hhadjdji hakim.hadj-djilani@inria.fr>
Date: Mon, 1 Feb 2021 13:52:33 +0100
Subject: [PATCH] Set level-3 optimization for compiling on 'Unix' systems and
 enable symbol stripping.

About 1Mo of size gained for shared library.
---
 CMakeLists.txt | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d2f15a5..ed4778b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -60,11 +60,14 @@ if(WIN32)
 	target_compile_definitions(gm PRIVATE NOMINMAX)
 endif()
 
+if(UNIX)
+	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
+	# strip all symbols
+	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s")
+endif()
+
 find_package(Eigen3 REQUIRED)
 if(EIGEN3_INCLUDE_DIR)
-	if(UNIX)
-		set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -O3)
-	endif()
 	foreach(GM_SCALAR float double cuComplex cuDoubleComplex)# complex<float> complex<double>)
 		#string(REGEX REPLACE "<|>" "" GM_SCALAR ${GM_SCALAR})
 		set(GM_SCALAR_FILE build/test_gm_${GM_SCALAR}.cpp)
-- 
GitLab