summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorJoel Rosdahl <joel@rosdahl.net>2020-10-07 08:15:20 +0200
committerJoel Rosdahl <joel@rosdahl.net>2020-10-07 08:15:20 +0200
commit144c106c4ec2b45581e1bcca4b36f30d417b4393 (patch)
treedd6f8df213ee14bd2cbc9751907e8b674d6d9f9b /CMakeLists.txt
parentb1310aea9553efaac89d18ff0c80e44ffe128945 (diff)
downloadccache-144c106c4ec2b45581e1bcca4b36f30d417b4393.tar.gz
Add option for enabling interprocedural (link time, LTO) optimization
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt8
1 files changed, 8 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f80a9c92..77fbd2cc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -24,6 +24,14 @@ include(StandardWarnings)
include(CIBuildType)
include(DefaultBuildType)
+if(NOT ${CMAKE_VERSION} VERSION_LESS "3.9")
+ cmake_policy(SET CMP0069 NEW)
+ option(ENABLE_IPO "Enable interprocedural (link time, LTO) optimization" OFF)
+ if(ENABLE_IPO)
+ set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
+ endif()
+endif()
+
#
# Configuration
#