aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorSefa Eyeoglu <contact@scrumplex.net>2022-04-15 16:02:06 +0200
committerGitHub <noreply@github.com>2022-04-15 16:02:06 +0200
commit8c98cc94581bf91ad0cc60ffaa67f9852050c066 (patch)
tree9aab46c64dfeea166894234f753cb24991d93ec6 /CMakeLists.txt
parent715d7d4424ae34f3ff60d03505197b26ebe660be (diff)
parent1b47132ebb5b825065833cdd08252466efe58faa (diff)
downloadPrismLauncher-8c98cc94581bf91ad0cc60ffaa67f9852050c066.tar.gz
PrismLauncher-8c98cc94581bf91ad0cc60ffaa67f9852050c066.tar.bz2
PrismLauncher-8c98cc94581bf91ad0cc60ffaa67f9852050c066.zip
Merge pull request #333 from oynqr/build/lto
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt18
1 files changed, 17 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1c51d7d4..c711fa4d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.9.4)
if(WIN32)
# In Qt 5.1+ we have our own main() function, don't autolink to qtmain on Windows
@@ -43,6 +43,22 @@ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Werror=return-type")
# Fix build with Qt 5.13
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DQT_NO_DEPRECATED_WARNINGS=Y")
+option(ENABLE_LTO "Enable Link Time Optimization" off)
+
+if(ENABLE_LTO)
+ include(CheckIPOSupported)
+ check_ipo_supported(RESULT ipo_supported OUTPUT ipo_error)
+
+ if(ipo_supported AND (CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel"))
+ message(STATUS "IPO / LTO enabled")
+ set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
+ elseif(ipo_supported)
+ message(STATUS "Not enabling IPO / LTO on debug builds")
+ else()
+ message(STATUS "IPO / LTO not supported: <${ipo_error}>")
+ endif()
+endif()
+
##################################### Set Application options #####################################
######## Set URLs ########