From 47df56ea367f98a80fa422231a16d07d00e13384 Mon Sep 17 00:00:00 2001 From: zhupengfei Date: Sat, 16 May 2020 19:50:08 +0800 Subject: [PATCH] Try add LTO --- CMakeLists.txt | 4 ++++ src/CMakeLists.txt | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 49363f3..3445130 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -128,6 +128,10 @@ elseif (CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU|SunOS)$") set(PLATFORM_LIBRARIES rt) endif() +if (NOT MSVC) + add_compile_options("-flto") +endif() + # Include source code # =================== add_subdirectory(externals) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8355b78..00f31f8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -104,7 +104,7 @@ else() if (MINGW_STATIC_BUILD) add_definitions(-DQT_STATICPLUGIN) - add_compile_options("-static -flto") + add_compile_options("-static") endif() endif()