Add -flto to compiler flags

fixes #12564
This commit is contained in:
Gunnar Beutner 2016-08-27 16:07:37 +02:00
parent 5cd2bdcbcd
commit 0d3563ddaa
1 changed files with 10 additions and 0 deletions

View File

@ -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(