mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Enable link time optimization (-flto).
This reduce target's size by 30%. Signed-off-by: Alexander GQ Gerasiov <gq@cs.msu.su>
This commit is contained in:
parent
8124ee50e8
commit
e1f818a1b6
@ -1,8 +1,23 @@
|
||||
project (ClickHouse)
|
||||
cmake_minimum_required (VERSION 3.3)
|
||||
cmake_minimum_required (VERSION 3.9)
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
|
||||
|
||||
set(ENABLE_IPO OFF CACHE STRING "Enable inter-procedural optimization (aka LTO)")
|
||||
|
||||
if (ENABLE_IPO)
|
||||
include(CheckIPOSupported)
|
||||
check_ipo_supported(RESULT IPO_SUPPORTED OUTPUT IPO_NOT_SUPPORTED)
|
||||
if(IPO_SUPPORTED)
|
||||
message(STATUS "IPO/LTO is supported, enabling")
|
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||
else()
|
||||
message(STATUS "IPO/LTO is not supported: <${IPO_NOT_SUPPORTED}>")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "IPO/LTO not enabled.")
|
||||
endif()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
# Require at least gcc 7
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7 AND NOT CMAKE_VERSION VERSION_LESS 2.8.9)
|
||||
|
Loading…
Reference in New Issue
Block a user