commit 4e66c86dfa7f8f79d41bc0964bda24e8459684d7
Author: Georg Baum <[email protected]>
Date: Wed Nov 5 20:54:24 2025 +0100
build: Improve ignoring 3rdparty warnings.
We are not interested in warnings from thirdparty code in general.
Instead of manually removing specific warnings, use system include
directories. This is supported by all modern compilers and cmake.
Also slightly modernize CMake setup using target specific properties.
---
3rdparty/hunspell/CMakeLists.txt | 12 +++---------
3rdparty/libiconv/CMakeLists.txt | 25 +++++++++----------------
3rdparty/mythes/CMakeLists.txt | 8 ++------
3rdparty/zlib/CMakeLists.txt | 5 ++---
4 files changed, 16 insertions(+), 34 deletions(-)
diff --git a/3rdparty/hunspell/CMakeLists.txt b/3rdparty/hunspell/CMakeLists.txt
index 56a0c6e2bf..cda7ccf854 100644
--- a/3rdparty/hunspell/CMakeLists.txt
+++ b/3rdparty/hunspell/CMakeLists.txt
@@ -11,14 +11,10 @@ endif()
project(hunspell)
-handle_warning_options("hunspell" "CXX" -Wno-suggest-final-types
-Wno-suggest-final-methods -Wno-unused-but-set-variable
-Wno-deprecated-declarations -Wno-format-nonliteral -Wno-unused-macros
-Wno-sign-compare -Wno-unused-parameter)
-
set(HUNSPELL_VERSION 1.7.2)
set(SRCDIR ${CMAKE_CURRENT_SOURCE_DIR}/${HUNSPELL_VERSION}/src)
-include_directories(./ ${SRCDIR}/hunspell)
-
# LIBS
set(SRCS
${SRCDIR}/hunspell/affentry.cxx
@@ -32,10 +28,6 @@ set(SRCS
${SRCDIR}/hunspell/hunspell.cxx
${SRCDIR}/hunspell/replist.cxx)
-handle_source_option("CC" ${SRCDIR}/hunspell/affixmgr.cxx -Wno-shadow)
-foreach(_base affixmgr suggestmgr)
- handle_source_option("CC" ${SRCDIR}/hunspell/${_base}.cxx
-Wno-null-dereference)
-endforeach()
set(HEADERS
${SRCDIR}/hunspell/affentry.hxx
${SRCDIR}/hunspell/htypes.hxx
@@ -55,8 +47,10 @@ set(HEADERS
${SRCDIR}/hunspell/replist.hxx
${SRCDIR}/hunspell/hunvisapi.h)
-add_definitions(-DHUNSPELL_STATIC)
add_library(hunspell STATIC ${HEADERS} ${SRCS} ${HUNCONFIG})
+target_compile_definitions(hunspell PRIVATE -DHUNSPELL_STATIC)
+# SYSTEM because we are not interested in any warning of this thirdparty
library
+target_include_directories(hunspell SYSTEM PRIVATE ./ ${SRCDIR}/hunspell)
set(HUNSPELL_LIBRARY hunspell CACHE STRING "Hunspell library" FORCE)
set(HUNSPELL_INCLUDE_DIR "${SRCDIR}/hunspell;${SRCDIR}" CACHE STRING "Hunspell
include dirs" FORCE)
diff --git a/3rdparty/libiconv/CMakeLists.txt b/3rdparty/libiconv/CMakeLists.txt
index 90d476da87..3428ad433b 100644
--- a/3rdparty/libiconv/CMakeLists.txt
+++ b/3rdparty/libiconv/CMakeLists.txt
@@ -25,8 +25,6 @@ set(LIBICONV_VERSION 1.18)
set(SRCDIR ${LIBICONV_VERSION})
-handle_warning_options("libiconv" "CC" -Werror -Wdeprecated-non-prototype
-Wstrict-prototypes -Wstatic-in-inline -Wparentheses-equality -Wundef
-Wno-reserved-macro-identifier -Wno-unused-parameter -Wno-sign-compare
-Wno-type-limits -Wno-implicit-fallthrough -Wno-cast-align
-Wno-parentheses-equality)
-
# Options
option(ENABLE_EXTRA "Enable a few rarely used encodings" OFF)
option(ENABLE_NLS "Translation of program messages to the user's native
@@ -52,14 +50,6 @@ configure_file(${SRCDIR}/srclib/uniwidth.in.h
${BINDIR}/srclib/uniwidth.h)
configure_file(${SRCDIR}/srclib/unitypes.in.h ${BINDIR}/srclib/unitypes.h)
configure_file(${SRCDIR}/include/iconv.h.in ${BINDIR}/include/iconv.h)
-# Dirty fix for MinGW
-if(MINGW)
- add_definitions(-DELOOP=0 -DHAVE_DECL_STRERROR_R=0)
-endif ()
-
-include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR} ${BINDIR}/include
${SRCDIR}/include ${SRCDIR}/srclib)
-add_definitions(-Dset_relocation_prefix=libcharset_set_relocation_prefix
-Drelocate=libcharset_relocate -DHAVE_CONFIG_H -DINSTALLPREFIX=NULL
-DNO_XMALLOC -DBUILDING_LIBCHARSET -DINSTALLDIR="" -DLIBDIR=""
-DENABLE_RELOCATABLE=1 -DIN_LIBRARY)
-
# libcharset
set(SRC_LIBCHARSET ${SRCDIR}/libcharset/lib/localcharset.c)
@@ -67,17 +57,20 @@ set(SRC_LIBCHARSET ${SRCDIR}/libcharset/lib/localcharset.c)
set(SRC_LIBICONV ${SRCDIR}/lib/compat.c ${SRCDIR}/lib/iconv.c)
add_library(iconv ${SRC_LIBICONV} ${SRC_LIBCHARSET})
-set_target_properties(iconv PROPERTIES COMPILE_FLAGS -DBUILDING_LIBICONV)
+
+# Dirty fix for MinGW
+if(MINGW)
+ target_compile_definitions(iconv PRIVATE -DELOOP=0 -DHAVE_DECL_STRERROR_R=0)
+endif ()
+
+# SYSTEM because we are not interested in any warning of this thirdparty
library
+target_include_directories(iconv SYSTEM BEFORE PRIVATE
${CMAKE_CURRENT_BINARY_DIR} ${BINDIR}/include ${SRCDIR}/include
${SRCDIR}/srclib)
+target_compile_definitions(iconv PRIVATE -DBUILDING_LIBICONV
-Dset_relocation_prefix=libcharset_set_relocation_prefix
-Drelocate=libcharset_relocate -DHAVE_CONFIG_H -DINSTALLPREFIX=NULL
-DNO_XMALLOC -DBUILDING_LIBCHARSET -DINSTALLDIR="" -DLIBDIR=""
-DENABLE_RELOCATABLE=1 -DIN_LIBRARY)
set(ICONV_INCLUDE_DIR ${BINDIR}/include CACHE STRING "libiconv include dir"
FORCE)
set(ICONV_LIBRARY iconv CACHE STRING "libiconv library" FORCE)
set(ICONV_FOUND iconv CACHE STRING "libiconv found" FORCE)
-foreach(_base iconv)
- handle_source_option("CC" ${SRCDIR}/lib/${_base}.c -Wno-unused-macros)
-endforeach()
-
-handle_source_option("CC" ${SRCDIR}/lib/iconv.c -Wno-cast-align
-Wno-parentheses-equality -Wno-static-in-inline -Wno-unused-parameter
-Wno-sign-compare -Wno-type-limits -Wno-missing-field-initializers
-Wno-redundant-decls -Wno-implicit-fallthrough -Wno-strict-prototypes)
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 581da20c9b..a7d94d5919 100644
--- a/3rdparty/mythes/CMakeLists.txt
+++ b/3rdparty/mythes/CMakeLists.txt
@@ -12,20 +12,16 @@ endif()
set(VERSION "1.2.5")
set(SRCDIR ${CMAKE_CURRENT_SOURCE_DIR}/${VERSION})
-handle_warning_options("mythes" "CXX" -Wno-stringop-truncation
-Wno-reserved-macro-identifier)
-if (${LYX_DEBUG_SANITIZE} MATCHES UNSPECIFIED)
- handle_source_option("CXX" ${SRCDIR}/mythes.cxx -Wno-nonnull)
-endif()
file(GLOB support_mythes_sources ${SRCDIR}/*.cxx)
file(GLOB support_mythes_headers ${SRCDIR}/*.hxx)
-include_directories(${VERSION})
-
#============================================================================
# lyxmytheslib
#============================================================================
add_library(mytheslibstatic STATIC ${support_mythes_sources}
${support_mythes_headers} )
+# SYSTEM because we are not interested in any warning of this thirdparty
library
+target_include_directories(mytheslibstatic SYSTEM PRIVATE ${VERSION})
set(MYTHESLIB_LIBRARY mytheslibstatic CACHE STRING "Mytheslib library" FORCE)
diff --git a/3rdparty/zlib/CMakeLists.txt b/3rdparty/zlib/CMakeLists.txt
index 6948dbcf74..809d8080a8 100644
--- a/3rdparty/zlib/CMakeLists.txt
+++ b/3rdparty/zlib/CMakeLists.txt
@@ -16,8 +16,6 @@ project(zlib C)
set(VERSION "1.3.1")
set(SRCDIR ${CMAKE_CURRENT_SOURCE_DIR}/${VERSION})
-handle_warning_options("zlib" "CC" -Wno-deprecated-non-prototype
-Wno-strict-prototypes -Wnested-anon-types -Wno-implicit-fallthrough
-Wno-format-nonliteral -Wno-reserved-macro-identifier -Wno-cast-align)
-
include(CheckTypeSize)
include(CheckFunctionExists)
include(CheckIncludeFile)
@@ -125,7 +123,8 @@ set(ZLIB_SRCS
)
add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS}
${ZLIB_PRIVATE_HDRS})
-target_include_directories(zlibstatic PUBLIC ${CMAKE_CURRENT_BINARY_DIR}
${SRCDIR})
+# SYSTEM because we are not interested in any warning of this thirdparty
library
+target_include_directories(zlibstatic SYSTEM PUBLIC
${CMAKE_CURRENT_BINARY_DIR} ${SRCDIR})
set(ZLIB_LIBRARY zlibstatic CACHE STRING "Zlib library" FORCE)
set(ZLIB_INCLUDE_DIR ${SRCDIR} CACHE STRING "Zlib include dir" FORCE)
--
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs