From 473205cab77bf56fc29cc661b2564455bab06676 Mon Sep 17 00:00:00 2001 From: RSDuck Date: Sat, 5 Dec 2020 21:10:00 +0100 Subject: [PATCH] fix non static LTO windows build --- CMakeLists.txt | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fcd4741c..59a3f2d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,9 +75,18 @@ if (CMAKE_BUILD_TYPE STREQUAL Release) add_link_options(-s) endif() +if (WIN32) + option(BUILD_STATIC "Statically link dependencies" OFF) +endif() + if (ENABLE_LTO) - add_compile_options(-flto -fPIC) - add_link_options(-flto -fuse-linker-plugin -pie) + if (WIN32) + add_compile_options(-flto) + add_link_options(-flto) + else() + add_compile_options(-flto -fPIC) + add_link_options(-flto -fuse-linker-plugin -pie) + endif() endif() if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") @@ -94,10 +103,6 @@ endif() option(BUILD_QT_SDL "Build Qt/SDL frontend" ON) -if (WIN32) - option(BUILD_STATIC "Statically link dependencies" OFF) -endif() - add_subdirectory(src) if (BUILD_QT_SDL)