From 9d49b4839d2887faa09ce3911caa24b441717975 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Thu, 31 Dec 2020 13:56:36 +0100 Subject: [PATCH] Reduce file size by using IPO and LTO. --- CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5473878..c416595 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,6 @@ cmake_minimum_required(VERSION 3.13) +include(CheckIPOSupported) + project(pkmnLib) # Enable all warnings, and make them error when occurring. @@ -102,6 +104,13 @@ file(GLOB_RECURSE CORE_SRC_FILES ${FILE_SOURCE}) add_library(pkmnLib ${LIBTYPE} ${CORE_SRC_FILES}) target_precompile_headers(pkmnLib PUBLIC src/Precompiled.hxx) +# If interprocedural optimization is available, apply it +check_ipo_supported(RESULT IPO_SUPPORTED) +if (IPO_SUPPORTED) + message(STATUS "IPO / LTO enabled") + set_property(TARGET pkmnLib PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) +endif () + SET(_LINKS CreatureLib Arbutils) SET(_TESTLINKS pkmnLib CreatureLib Arbutils)