From dd16a012a4f1423eafb8be05b3302960a36b7cab Mon Sep 17 00:00:00 2001 From: proller Date: Fri, 25 Jan 2019 22:18:05 +0300 Subject: [PATCH] IPO fixes --- CMakeLists.txt | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b1903a43d3..f7297f31ed8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,19 +1,19 @@ project (ClickHouse) -cmake_minimum_required (VERSION 3.9) +cmake_minimum_required (VERSION 3.3) 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() +option(ENABLE_IPO "Enable inter-procedural optimization (aka LTO)" OFF) # need cmake 3.9+ +if(ENABLE_IPO) + cmake_policy(SET CMP0069 NEW) + 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()