diff options
author | Brad King <brad.king@kitware.com> | 2018-10-29 13:24:37 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-10-29 13:25:46 (GMT) |
commit | 6ece73dccb37278b92e631e1135283ae374f0aa7 (patch) | |
tree | 6b2fc93c98efbc37deb67839f2db09a125dd37fb | |
parent | 01c6f99c2d7278d41aa4832df739d4ac1849258c (diff) | |
parent | 786dddc0fd0439b7f7ba1f062d60720f16627856 (diff) | |
download | CMake-6ece73dccb37278b92e631e1135283ae374f0aa7.zip CMake-6ece73dccb37278b92e631e1135283ae374f0aa7.tar.gz CMake-6ece73dccb37278b92e631e1135283ae374f0aa7.tar.bz2 |
Merge topic 'EnableIPOBuild'
786dddc0fd Add option to build CMake itself with IPO/LTO
53e65e8e0a curl: Do not call cmake_minimum_required inside CMake itself
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2505
-rw-r--r-- | CMakeLists.txt | 12 | ||||
-rw-r--r-- | Utilities/cmcurl/CMakeLists.txt | 1 |
2 files changed, 12 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e94503c..756e379 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -117,6 +117,18 @@ option(CMake_BUILD_DEVELOPER_REFERENCE "Build CMake Developer Reference" OFF) mark_as_advanced(CMake_BUILD_DEVELOPER_REFERENCE) +# option to build using interprocedural optimizations (IPO/LTO) +if (NOT CMAKE_VERSION VERSION_LESS 3.12.2) + option(CMake_BUILD_LTO "Compile CMake with link-time optimization if supported" OFF) + if(CMake_BUILD_LTO) + include(CheckIPOSupported) + check_ipo_supported(RESULT HAVE_IPO) + if(HAVE_IPO) + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) + endif() + endif() +endif() + #----------------------------------------------------------------------- # a macro to deal with system libraries, implemented as a macro # simply to improve readability of the main script diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt index 636530e..f38b7d4 100644 --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt @@ -123,7 +123,6 @@ endif() # To check: # (From Daniel Stenberg) The cmake build selected to run gcc with -fPIC on my box while the plain configure script did not. # (From Daniel Stenberg) The gcc command line use neither -g nor any -O options. As a developer, I also treasure our configure scripts's --enable-debug option that sets a long range of "picky" compiler options. -cmake_minimum_required(VERSION 3.0 FATAL_ERROR) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake;${CMAKE_MODULE_PATH}") include(Utilities) include(Macros) |