Put LTO behind an optional flag
This commit is contained in:
parent
c7c83a35fa
commit
dfa5f614aa
@ -43,16 +43,20 @@ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Werror=return-type")
|
|||||||
# Fix build with Qt 5.13
|
# Fix build with Qt 5.13
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DQT_NO_DEPRECATED_WARNINGS=Y")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DQT_NO_DEPRECATED_WARNINGS=Y")
|
||||||
|
|
||||||
include(CheckIPOSupported)
|
option(ENABLE_LTO "Enable Link Time Optimization" off)
|
||||||
check_ipo_supported(RESULT ipo_supported OUTPUT ipo_error)
|
|
||||||
|
|
||||||
if(ipo_supported AND (CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel"))
|
if(ENABLE_LTO)
|
||||||
message(STATUS "IPO / LTO enabled")
|
include(CheckIPOSupported)
|
||||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
|
check_ipo_supported(RESULT ipo_supported OUTPUT ipo_error)
|
||||||
elseif(ipo_supported)
|
|
||||||
message(STATUS "Not enabling IPO / LTO on debug builds")
|
if(ipo_supported AND (CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel"))
|
||||||
else()
|
message(STATUS "IPO / LTO enabled")
|
||||||
message(STATUS "IPO / LTO not supported: <${ipo_error}>")
|
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()
|
endif()
|
||||||
|
|
||||||
##################################### Set Application options #####################################
|
##################################### Set Application options #####################################
|
||||||
|
Loading…
Reference in New Issue
Block a user