add WITH_LTO option to disble lto on compile time

pull/1284/head
Jeff Becker 4 years ago
parent 7cb542ea23
commit a6d17dcd16
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -1,10 +1,16 @@
# -flto
include(CheckIPOSupported)
check_ipo_supported(RESULT IPO_ENABLED OUTPUT ipo_error)
if(IPO_ENABLED)
message(STATUS "LTO enabled")
option(WITH_LTO "enable lto on compile time" ON)
if(WITH_LTO)
check_ipo_supported(RESULT IPO_ENABLED OUTPUT ipo_error)
if(IPO_ENABLED)
message(STATUS "LTO enabled")
else()
message(WARNING "LTO not supported by compiler: ${ipo_error}")
endif()
else()
message(WARNING "LTO not supported by compiler: ${ipo_error}")
message(STATUS "LTO disabled")
set(IPO_ENABLED OFF)
endif()
function(enable_lto)

Loading…
Cancel
Save