Add LTO toggle to DoConfig CMakeLists.txt

This commit is contained in:
Clownacy 2020-01-23 01:00:07 +00:00
parent c45e888b74
commit 413fe560e4

View file

@ -8,6 +8,7 @@ if((${CMAKE_VERSION} VERSION_EQUAL 3.11) OR (${CMAKE_VERSION} VERSION_GREATER 3.
cmake_policy(SET CMP0072 NEW) cmake_policy(SET CMP0072 NEW)
endif() endif()
option(LTO "Enable link-time optimisation" OFF)
option(WARNINGS "Enable common compiler warnings (for GCC-compatible compilers and MSVC only)" OFF) option(WARNINGS "Enable common compiler warnings (for GCC-compatible compilers and MSVC only)" OFF)
option(WARNINGS_ALL "Enable ALL compiler warnings (for Clang and MSVC only)" OFF) option(WARNINGS_ALL "Enable ALL compiler warnings (for Clang and MSVC only)" OFF)
option(WARNINGS_FATAL "Stop compilation on any compiler warning (for GCC-compatible compilers and MSVC only)" OFF) option(WARNINGS_FATAL "Stop compilation on any compiler warning (for GCC-compatible compilers and MSVC only)" OFF)
@ -140,7 +141,7 @@ else()
endif() endif()
# Enable link-time optimisation if available # Enable link-time optimisation if available
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") if(LTO)
if((${CMAKE_VERSION} VERSION_EQUAL 3.9) OR (${CMAKE_VERSION} VERSION_GREATER 3.9)) if((${CMAKE_VERSION} VERSION_EQUAL 3.9) OR (${CMAKE_VERSION} VERSION_GREATER 3.9))
include(CheckIPOSupported) include(CheckIPOSupported)
check_ipo_supported(RESULT result) check_ipo_supported(RESULT result)