mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-11 07:10:36 +00:00
21 lines
507 B
CMake
21 lines
507 B
CMake
# -flto
|
|
include(CheckIPOSupported)
|
|
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(STATUS "LTO disabled")
|
|
set(IPO_ENABLED OFF)
|
|
endif()
|
|
|
|
function(enable_lto)
|
|
if(IPO_ENABLED)
|
|
set_target_properties(${ARGN} PROPERTIES INTERPROCEDURAL_OPTIMIZATION ON)
|
|
endif()
|
|
endfunction()
|