diff options
author | Nadia Holmquist Pedersen <nadia@nhp.sh> | 2020-11-06 12:03:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-06 12:03:02 +0100 |
commit | ec232a936537a0a3eda5f164c038c503a7af506e (patch) | |
tree | 13e8470c2ca1b7b8a83f13a16b570e4b913f08fe | |
parent | ad7791f72661eece13e81dfd1323793293054c5e (diff) |
Fix building the Qt frontend with LTO (#802)
* Remove unnecessary -fno-pic/-no-pie, fixes LTO builds
* restore -no-pie because GNOME is derpy
-rw-r--r-- | CMakeLists.txt | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b8d699..08f7f8d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,9 +65,21 @@ if (CMAKE_BUILD_TYPE STREQUAL Release) add_link_options(-s) endif() -add_compile_options(-fno-pic) add_link_options(-no-pie) +if (ENABLE_LTO) + add_compile_options(-flto) + add_link_options(-flto) + + if (CMAKE_C_COMPILER_ID STREQUAL "GCC") + set(CMAKE_AR "gcc-ar") + set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>") + set(CMAKE_C_ARCHIVE_FINISH true) + set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>") + set(CMAKE_CXX_ARCHIVE_FINISH true) + endif() +endif() + option(BUILD_QT_SDL "Build Qt/SDL frontend" ON) if (WIN32) |