]> git.lyx.org Git - features.git/commitdiff
Cmake build: Use interprocedural optimization if possible
authorKornel Benko <kornel@lyx.org>
Mon, 22 Apr 2019 16:49:03 +0000 (18:49 +0200)
committerKornel Benko <kornel@lyx.org>
Mon, 22 Apr 2019 16:53:49 +0000 (18:53 +0200)
With gnu compilers this adds -flto and -fno-fat-lto-objects
to compiler and linker flags.

3rdparty/hunspell/CMakeLists.txt
3rdparty/libiconv/CMakeLists.txt
3rdparty/mythes/CMakeLists.txt
3rdparty/zlib/CMakeLists.txt
CMakeLists.txt

index 72e5c52133f789dbc3abbca73e19b030b102f800..9dbb56cd791c96876b5e77a86eee0ebf3d9845e5 100644 (file)
@@ -1,5 +1,9 @@
 
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 3.1)
+
+if (POLICY CMP0069)
+  cmake_policy(SET CMP0069 NEW)
+endif()
 
 project(hunspell)
 
index 68b7dd76c8143e389ff2205511ce2366213b8e32..7f5c73bf7f67c75012267fb7bf9099afa4adcc45 100644 (file)
@@ -5,7 +5,12 @@
 # Please note that the package source code is licensed under its own license.
 
 project ( libiconv C )
-cmake_minimum_required ( VERSION 2.8 )
+cmake_minimum_required(VERSION 3.1)
+
+if (POLICY CMP0069)
+  cmake_policy(SET CMP0069 NEW)
+endif()
+
 set(CMAKE_MODULE_PATH .)
 include ( configure.cmake )
 
index c6d11780d9b1d08170eb252b39a8b9eac0e72948..9457df2b73185448ceec1f9da8d32b961ca6d926 100644 (file)
@@ -1,4 +1,8 @@
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 3.1)
+
+if (POLICY CMP0069)
+  cmake_policy(SET CMP0069 NEW)
+endif()
 
 set(VERSION "1.2.5")
 set(SRCDIR ${CMAKE_CURRENT_SOURCE_DIR}/${VERSION})
index a9fad6fa5453d11394fe04df5e2a038da8cf98b8..a8ca489369aaefcf5b5eda6682ea18e31567b769 100644 (file)
@@ -1,4 +1,9 @@
-cmake_minimum_required(VERSION 2.4.4)
+cmake_minimum_required(VERSION 3.1)
+
+if (POLICY CMP0069)
+  cmake_policy(SET CMP0069 NEW)
+endif()
+
 set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
 
 project(zlib C)
index e421c535b923aa8136cca2bd7751a26e5c1a9a67..e8c3c32c94fa9fcbd4f3e0112ca32f40820214fc 100644 (file)
@@ -81,6 +81,18 @@ if(NOT help AND NOT HELP)
       message(FATAL_ERROR "Exiting")
     endif()
   endif()
+  # Enable LTO if supported
+  if (POLICY CMP0069)
+    cmake_policy(SET CMP0069 NEW)
+    include(CheckIPOSupported)
+    check_ipo_supported(RESULT result OUTPUT reason LANGUAGES CXX)
+    if(result)
+      message(STATUS "Setting IPO True")
+      set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
+    else()
+      message(STATUS "Not setting IPO , result = ${result}, reason = ${reason}")
+    endif()
+  endif()
 endif()
 
 if(UNIX)