aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorPhilipp David <pd@3b.pm>2022-03-19 18:08:28 +0100
committerPhilipp David <pd@3b.pm>2022-03-22 21:04:35 +0100
commitc7c83a35fa74b419145f2e5013873bf98bf46df5 (patch)
tree6148dccae50308364436c4e4533f2b0e79d8e933 /CMakeLists.txt
parentc7fdfb811669a863606dc0a26186c0ab827db9c6 (diff)
downloadPrismLauncher-c7c83a35fa74b419145f2e5013873bf98bf46df5.tar.gz
PrismLauncher-c7c83a35fa74b419145f2e5013873bf98bf46df5.tar.bz2
PrismLauncher-c7c83a35fa74b419145f2e5013873bf98bf46df5.zip
Enable LTO/IPO on release builds
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt14
1 files changed, 13 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7537703c..889d6fc4 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,18 @@ 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")
+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()
+
##################################### Set Application options #####################################
######## Set URLs ########