Cmake build: Remove warnings about deprecated policy CMP0069

Deprecated since cmake version 3.16
(Now explicitly enable/disable interprocedural optimization
if supported and not debugging)
This commit is contained in:
Kornel Benko 2019-11-09 16:56:16 +01:00
parent 2f44d9b4fa
commit c9c86b4966
7 changed files with 42 additions and 18 deletions

View File

@ -1,11 +1,12 @@
cmake_minimum_required(VERSION 3.1) cmake_minimum_required(VERSION 3.1)
set(LYX_IPO_SUPPORTED FALSE)
if (POLICY CMP0069) if (POLICY CMP0069)
if (LYX_DEBUG) if (NOT LYX_DEBUG)
cmake_policy(SET CMP0069 OLD)
else()
cmake_policy(SET CMP0069 NEW) cmake_policy(SET CMP0069 NEW)
include(CheckIPOSupported)
check_ipo_supported(RESULT LYX_IPO_SUPPORTED)
endif() endif()
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_INCLUDE_DIR ${SRCDIR} CACHE STRING "Hunspell include dir" FORCE)
set(HUNSPELL_FOUND CACHE STRING "Hunspell found" 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})

View File

@ -7,8 +7,13 @@
project ( libiconv C ) project ( libiconv C )
cmake_minimum_required(VERSION 3.1) cmake_minimum_required(VERSION 3.1)
set(LYX_IPO_SUPPORTED FALSE)
if (POLICY CMP0069) if (POLICY CMP0069)
if (NOT LYX_DEBUG)
cmake_policy(SET CMP0069 NEW) cmake_policy(SET CMP0069 NEW)
include(CheckIPOSupported)
check_ipo_supported(RESULT LYX_IPO_SUPPORTED)
endif()
endif() endif()
set(CMAKE_MODULE_PATH .) 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_LIBRARY iconv CACHE STRING "libiconv library" FORCE)
set(ICONV_FOUND iconv CACHE STRING "libiconv found" 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})

View File

@ -1,10 +1,11 @@
cmake_minimum_required(VERSION 3.1) cmake_minimum_required(VERSION 3.1)
set(LYX_IPO_SUPPORTED FALSE)
if (POLICY CMP0069) if (POLICY CMP0069)
if (LYX_DEBUG) if (NOT LYX_DEBUG)
cmake_policy(SET CMP0069 OLD)
else()
cmake_policy(SET CMP0069 NEW) cmake_policy(SET CMP0069 NEW)
include(CheckIPOSupported)
check_ipo_supported(RESULT LYX_IPO_SUPPORTED)
endif() endif()
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_INCLUDE_DIR ${SRCDIR} CACHE STRING "Mytheslib include dir" FORCE)
set(MYTHESLIB_FOUND CACHE STRING "Mytheslib found" 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})

View File

@ -1,7 +1,12 @@
cmake_minimum_required(VERSION 3.1) cmake_minimum_required(VERSION 3.1)
set(LYX_IPO_SUPPORTED FALSE)
if (POLICY CMP0069) if (POLICY CMP0069)
if (NOT LYX_DEBUG)
cmake_policy(SET CMP0069 NEW) cmake_policy(SET CMP0069 NEW)
include(CheckIPOSupported)
check_ipo_supported(RESULT LYX_IPO_SUPPORTED)
endif()
endif() endif()
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) 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_INCLUDE_DIR ${SRCDIR} CACHE STRING "Zlib include dir" FORCE)
set(ZLIB_FOUND CACHE STRING "Zlib found" 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})

View File

@ -82,11 +82,12 @@ if(NOT help AND NOT HELP)
endif() endif()
endif() endif()
# Enable LTO if supported and not debugging # Enable LTO if supported and not debugging
set(LYX_IPO_SUPPORTED FALSE)
if (POLICY CMP0069) if (POLICY CMP0069)
if (LYX_DEBUG) if (NOT LYX_DEBUG)
cmake_policy(SET CMP0069 OLD)
else()
cmake_policy(SET CMP0069 NEW) cmake_policy(SET CMP0069 NEW)
include(CheckIPOSupported)
check_ipo_supported(RESULT LYX_IPO_SUPPORTED)
endif() endif()
endif() endif()
endif() endif()

View File

@ -122,8 +122,9 @@ add_executable(${_lyx}
add_dependencies(${_lyx} lyx_version) 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}) lyx_add_gcc_pch(${_lyx})
target_link_libraries(${_lyx} target_link_libraries(${_lyx}

View File

@ -40,7 +40,9 @@ else()
lyx_const_touched_files(_allinone_linked LINKED_sources) lyx_const_touched_files(_allinone_linked LINKED_sources)
add_executable(${_tex2lyx} ${_allinone_files} ${_allinone_linked_files} ${FILE_RC}) add_executable(${_tex2lyx} ${_allinone_files} ${_allinone_linked_files} ${FILE_RC})
endif() 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} target_link_libraries(${_tex2lyx}
support support