From aaaad658b0c0aa732b428d41d0791202427ad01b Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sat, 12 Sep 2020 17:04:43 +0200 Subject: [PATCH] Use ThinLTO for shared library building. Signed-off-by: Deukhoofd --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index de675be..15ecaca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,6 +31,10 @@ find_package(Threads REQUIRED) set(LIBTYPE STATIC) if (SHARED) set(LIBTYPE SHARED) + if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + add_compile_options(-flto=thin) + add_link_options(-flto=thin) + endif () endif (SHARED) if (LEVEL_SIZE STREQUAL "8")