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 # -flto
include(CheckIPOSupported) include(CheckIPOSupported)
check_ipo_supported(RESULT IPO_ENABLED OUTPUT ipo_error) option(WITH_LTO "enable lto on compile time" ON)
if(IPO_ENABLED) if(WITH_LTO)
message(STATUS "LTO enabled") 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() else()
message(WARNING "LTO not supported by compiler: ${ipo_error}") message(STATUS "LTO disabled")
set(IPO_ENABLED OFF)
endif() endif()
function(enable_lto) function(enable_lto)

Loading…
Cancel
Save