[icinga-checkins] icinga.org: icinga2/master: Add -flto to compiler flags

git at icinga.org git at icinga.org
Sat Aug 27 16:07:44 CEST 2016


Module: icinga2
Branch: master
Commit: 0d3563ddaac73a8c0a5965369aff80f9549dbe8b
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=0d3563ddaac73a8c0a5965369aff80f9549dbe8b

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Sat Aug 27 16:07:37 2016 +0200

Add -flto to compiler flags

fixes #12564

---

 CMakeLists.txt |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6abd47f..5032229 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -259,6 +259,16 @@ if(NOT MSVC)
   endif()
 endif()
 
+check_cxx_compiler_flag("-flto" CXX_FLAG_LTO)
+
+if(CXX_FLAG_LTO)
+  set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_DEBUG} -flto")
+  set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_DEBUG} -flto")
+
+  set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_DEBUG} -flto")
+  set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_DEBUG} -flto")
+endif()
+
 configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h ESCAPE_QUOTES)
 
 install(



More information about the icinga-checkins mailing list