Open morinim opened 6 years ago
This code enables LTO (if available):
project(VITA)
include(CheckIPOSupported)
...
if (CMAKE_BUILD_TYPE MATCHES "Release")
check_ipo_supported(RESULT supported_ipo OUTPUT error_ipo)
if (supported_ipo)
message(STATUS "IPO / LTO supported: <${supported_ipo}>")
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
else ()
message(STATUS "IPO / LTO not supported: <${error_ipo}>")
endif()
endif()
Unfortunately preliminary tests show worse performance. Further investigation required...
CMake v3.9 finally supports LTO.
Here's an example code to show how it works:
See also: