Add CMake options to suppress C++17 deprecation warnings for RapidJSON on Apple Clang
Some checks failed
Build / Build openSUSE (leap:15.6) (push) Has been cancelled
Build / Build openSUSE (leap:16.0) (push) Has been cancelled
Build / Build openSUSE (tumbleweed) (push) Has been cancelled
Build / Build Fedora (42) (push) Has been cancelled
Build / Build Fedora (43) (push) Has been cancelled
Build / Build Fedora (44) (push) Has been cancelled
Build / Build OpenMandriva (cooker) (push) Has been cancelled
Build / Build Mageia (9) (push) Has been cancelled
Build / Build Debian (bookworm) (push) Has been cancelled
Build / Build Debian (forky) (push) Has been cancelled
Build / Build Debian (trixie) (push) Has been cancelled
Build / Build Ubuntu (noble) (push) Has been cancelled
Build / Build Ubuntu (questing) (push) Has been cancelled
Build / Build Ubuntu (resolute) (push) Has been cancelled
Build / Upload Ubuntu PPA (noble) (push) Has been cancelled
Build / Upload Ubuntu PPA (questing) (push) Has been cancelled
Build / Upload Ubuntu PPA (resolute) (push) Has been cancelled
Build / Build FreeBSD (push) Has been cancelled
Build / Build OpenBSD (push) Has been cancelled
Build / Build macOS Public (release, macos-15) (push) Has been cancelled
Build / Build macOS Public (release, macos-15-intel) (push) Has been cancelled
Build / Build macOS Private (release, macos-arm64) (push) Has been cancelled
Build / Build Windows MinGW (i686, debug) (push) Has been cancelled
Build / Build Windows MinGW (i686, release) (push) Has been cancelled
Build / Build Windows MinGW (x86_64, debug) (push) Has been cancelled
Build / Build Windows MinGW (x86_64, release) (push) Has been cancelled
Build / Build Windows MSVC (arm64, debug, arm64 debug, windows-11-arm) (push) Has been cancelled
Build / Build Windows MSVC (arm64, release, arm64 release, windows-11-arm) (push) Has been cancelled
Build / Build Windows MSVC (x86, debug, x86 debug, windows-2022) (push) Has been cancelled
Build / Build Windows MSVC (x86, release, x86 release, windows-2022) (push) Has been cancelled
Build / Build Windows MSVC (x86_64, debug, x86_64 debug, windows-2022) (push) Has been cancelled
Build / Build Windows MSVC (x86_64, release, x86_64 release, windows-2022) (push) Has been cancelled
Build / Upload (push) Has been cancelled
Build / Attach to release (push) Has been cancelled

This commit introduces a new compile option in the discord-rpc CMake configuration to suppress C++17 deprecation warnings triggered by RapidJSON when compiled with AppleClang. Additionally, it treats Boost headers as system headers in the Strawberry library to reduce warning noise during builds with strict flags. These changes aim to improve the build experience and maintain cleaner output logs.
This commit is contained in:
David Helkowski
2026-01-23 01:00:24 +09:00
parent 2acd94a04a
commit 4735e8feea
2 changed files with 22 additions and 0 deletions

View File

@@ -33,6 +33,13 @@ if(APPLE)
target_link_libraries(discord-rpc PRIVATE "-framework AppKit")
endif()
# RapidJSON (as packaged by Homebrew and others) can trigger C++17 deprecation
# warnings (e.g. std::iterator) when compiled with AppleClang/libc++.
# Keep the suppression narrowly scoped to this 3rdparty target.
if(APPLE AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_compile_options(discord-rpc PRIVATE -Wno-deprecated-declarations)
endif()
if(WIN32)
target_link_libraries(discord-rpc PRIVATE psapi advapi32)
endif()

View File

@@ -1517,6 +1517,21 @@ qt_add_resources(SOURCES data/data.qrc data/icons.qrc)
add_library(strawberry_lib STATIC ${SOURCES})
# Treat Boost headers as system headers to avoid noisy warnings from 3rdparty
# Boost code (e.g. -Wold-style-cast) when building Strawberry with strict flags.
set(_strawberry_boost_system_includes "")
if(TARGET Boost::headers)
get_target_property(_strawberry_boost_system_includes Boost::headers INTERFACE_INCLUDE_DIRECTORIES)
elseif(TARGET Boost::boost)
get_target_property(_strawberry_boost_system_includes Boost::boost INTERFACE_INCLUDE_DIRECTORIES)
elseif(DEFINED Boost_INCLUDE_DIRS)
set(_strawberry_boost_system_includes "${Boost_INCLUDE_DIRS}")
endif()
if(_strawberry_boost_system_includes)
target_include_directories(strawberry_lib SYSTEM PRIVATE ${_strawberry_boost_system_includes})
endif()
unset(_strawberry_boost_system_includes)
target_sources(strawberry PRIVATE src/main.cpp)
if(WIN32)