-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Labels
Description
CMake v3.9 finally supports LTO.
Here's an example code to show how it works:
cmake_minimum_required(VERSION 3.9.4)
include(CheckIPOSupported)
check_ipo_supported(RESULT supported OUTPUT error)
add_executable(example Example.cpp)
if (supported)
message(STATUS "IPO / LTO enabled")
set_property(TARGET example PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
else ()
message(STATUS "IPO / LTO not supported: <${error}>")
endif()
See also: