+
Skip to content

CMake support for link time optimization (aka IPO) #18

@morinim

Description

@morinim

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:

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载