diff --git a/3rdparty/hunspell/CMakeLists.txt b/3rdparty/hunspell/CMakeLists.txt index ad67b43865..9921d6d88a 100644 --- a/3rdparty/hunspell/CMakeLists.txt +++ b/3rdparty/hunspell/CMakeLists.txt @@ -1,11 +1,12 @@ cmake_minimum_required(VERSION 3.1) +set(LYX_IPO_SUPPORTED FALSE) if (POLICY CMP0069) - if (LYX_DEBUG) - cmake_policy(SET CMP0069 OLD) - else() + if (NOT LYX_DEBUG) cmake_policy(SET CMP0069 NEW) + include(CheckIPOSupported) + check_ipo_supported(RESULT LYX_IPO_SUPPORTED) endif() endif() @@ -61,4 +62,6 @@ set(HUNSPELL_LIBRARY hunspell CACHE STRING "Hunspell library" FORCE) set(HUNSPELL_INCLUDE_DIR ${SRCDIR} CACHE STRING "Hunspell include dir" FORCE) set(HUNSPELL_FOUND CACHE STRING "Hunspell found" FORCE) -set_target_properties(hunspell PROPERTIES FOLDER "3rd_party") +set_target_properties(hunspell PROPERTIES + FOLDER "3rd_party" + INTERPROCEDURAL_OPTIMIZATION ${LYX_IPO_SUPPORTED}) diff --git a/3rdparty/libiconv/CMakeLists.txt b/3rdparty/libiconv/CMakeLists.txt index 7f5c73bf7f..6261b3cb30 100644 --- a/3rdparty/libiconv/CMakeLists.txt +++ b/3rdparty/libiconv/CMakeLists.txt @@ -7,8 +7,13 @@ project ( libiconv C ) cmake_minimum_required(VERSION 3.1) +set(LYX_IPO_SUPPORTED FALSE) if (POLICY CMP0069) - cmake_policy(SET CMP0069 NEW) + if (NOT LYX_DEBUG) + cmake_policy(SET CMP0069 NEW) + include(CheckIPOSupported) + check_ipo_supported(RESULT LYX_IPO_SUPPORTED) + endif() endif() set(CMAKE_MODULE_PATH .) @@ -59,4 +64,6 @@ set(ICONV_INCLUDE_DIR ${BINDIR}/include CACHE STRING "libiconv include dir" FOR set(ICONV_LIBRARY iconv CACHE STRING "libiconv library" FORCE) set(ICONV_FOUND iconv CACHE STRING "libiconv found" FORCE) -set_target_properties(iconv PROPERTIES FOLDER "3rd_party") +set_target_properties(iconv PROPERTIES + FOLDER "3rd_party" + INTERPROCEDURAL_OPTIMIZATION ${LYX_IPO_SUPPORTED}) diff --git a/3rdparty/mythes/CMakeLists.txt b/3rdparty/mythes/CMakeLists.txt index d970ef23c3..1b224a9d4c 100644 --- a/3rdparty/mythes/CMakeLists.txt +++ b/3rdparty/mythes/CMakeLists.txt @@ -1,10 +1,11 @@ cmake_minimum_required(VERSION 3.1) +set(LYX_IPO_SUPPORTED FALSE) if (POLICY CMP0069) - if (LYX_DEBUG) - cmake_policy(SET CMP0069 OLD) - else() + if (NOT LYX_DEBUG) cmake_policy(SET CMP0069 NEW) + include(CheckIPOSupported) + check_ipo_supported(RESULT LYX_IPO_SUPPORTED) endif() endif() @@ -27,4 +28,6 @@ set(MYTHESLIB_LIBRARY mytheslibstatic CACHE STRING "Mytheslib library" FORCE) set(MYTHESLIB_INCLUDE_DIR ${SRCDIR} CACHE STRING "Mytheslib include dir" FORCE) set(MYTHESLIB_FOUND CACHE STRING "Mytheslib found" FORCE ) -set_target_properties(mytheslibstatic PROPERTIES FOLDER "3rd_party") +set_target_properties(mytheslibstatic PROPERTIES + FOLDER "3rd_party" + INTERPROCEDURAL_OPTIMIZATION ${LYX_IPO_SUPPORTED}) diff --git a/3rdparty/zlib/CMakeLists.txt b/3rdparty/zlib/CMakeLists.txt index a8ca489369..b14776ef45 100644 --- a/3rdparty/zlib/CMakeLists.txt +++ b/3rdparty/zlib/CMakeLists.txt @@ -1,7 +1,12 @@ cmake_minimum_required(VERSION 3.1) +set(LYX_IPO_SUPPORTED FALSE) if (POLICY CMP0069) - cmake_policy(SET CMP0069 NEW) + if (NOT LYX_DEBUG) + cmake_policy(SET CMP0069 NEW) + include(CheckIPOSupported) + check_ipo_supported(RESULT LYX_IPO_SUPPORTED) + endif() endif() set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) @@ -163,4 +168,6 @@ set(ZLIB_LIBRARY zlibstatic CACHE STRING "Zlib library" FORCE) set(ZLIB_INCLUDE_DIR ${SRCDIR} CACHE STRING "Zlib include dir" FORCE) set(ZLIB_FOUND CACHE STRING "Zlib found" FORCE ) -set_target_properties(zlibstatic PROPERTIES FOLDER "3rd_party") +set_target_properties(zlibstatic PROPERTIES + FOLDER "3rd_party" + INTERPROCEDURAL_OPTIMIZATION ${LYX_IPO_SUPPORTED}) diff --git a/CMakeLists.txt b/CMakeLists.txt index f759d8f45b..779d9e932d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,11 +82,12 @@ if(NOT help AND NOT HELP) endif() endif() # Enable LTO if supported and not debugging + set(LYX_IPO_SUPPORTED FALSE) if (POLICY CMP0069) - if (LYX_DEBUG) - cmake_policy(SET CMP0069 OLD) - else() + if (NOT LYX_DEBUG) cmake_policy(SET CMP0069 NEW) + include(CheckIPOSupported) + check_ipo_supported(RESULT LYX_IPO_SUPPORTED) endif() endif() endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 39c751f3ff..7793179431 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -122,8 +122,9 @@ add_executable(${_lyx} add_dependencies(${_lyx} lyx_version) -set_target_properties(${_lyx} PROPERTIES FOLDER "applications/LyX") - +set_target_properties(${_lyx} PROPERTIES + FOLDER "applications/LyX" + INTERPROCEDURAL_OPTIMIZATION ${LYX_IPO_SUPPORTED}) lyx_add_gcc_pch(${_lyx}) target_link_libraries(${_lyx} diff --git a/src/tex2lyx/CMakeLists.txt b/src/tex2lyx/CMakeLists.txt index 36db7234df..1927655c7f 100644 --- a/src/tex2lyx/CMakeLists.txt +++ b/src/tex2lyx/CMakeLists.txt @@ -40,7 +40,9 @@ else() lyx_const_touched_files(_allinone_linked LINKED_sources) add_executable(${_tex2lyx} ${_allinone_files} ${_allinone_linked_files} ${FILE_RC}) endif() -set_target_properties(${_tex2lyx} PROPERTIES FOLDER "applications/TeX2LyX") +set_target_properties(${_tex2lyx} PROPERTIES + FOLDER "applications/TeX2LyX" + INTERPROCEDURAL_OPTIMIZATION ${LYX_IPO_SUPPORTED}) target_link_libraries(${_tex2lyx} support