Reduce file size by using IPO and LTO.
continuous-integration/drone/push Build is passing Details

Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
Deukhoofd 2020-12-31 13:52:11 +01:00
parent 207d4bd799
commit 941927336e
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
1 changed files with 9 additions and 0 deletions

View File

@ -1,4 +1,6 @@
cmake_minimum_required(VERSION 3.16)
include(CheckIPOSupported)
project(CreatureLib)
# Enable all warnings, and make them error when occurring.
@ -59,6 +61,13 @@ file(GLOB_RECURSE LIBRARY_SRC_FILES
add_library(CreatureLib SHARED ${LIBRARY_SRC_FILES})
target_precompile_headers(CreatureLib 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 CreatureLib PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
endif ()
# If we are building for Windows we need to set some specific variables.
if (WINDOWS)
MESSAGE(WARNING, "Using Windows Build.")