Silence the discarded isalpha result warning in fmt on MSVC

fmt 12.1.0 calls std::isalpha in locale_ref's constructor only to check
that it is found via ADL, and discards the result. MSVC's standard
library marks the function [[nodiscard]], so compiling fmt's format.cc
gives C4834. Disable that warning for the fetched fmt target only.
This commit is contained in:
Erik Fröjdh committed 2026-10-05 21:10:53 +02:00
1 parent f4b6ef61d5
commit a7f5d0c348
1 file changed
+5
+5
View File
@@ -208,6 +208,11 @@ if(AARE_FETCH_FMT)
CACHE BOOL "")
FetchContent_MakeAvailable(fmt)
set_property(TARGET fmt PROPERTY POSITION_INDEPENDENT_CODE ON)
if(MSVC)
# fmt 12.1.0 calls std::isalpha only to check that ADL finds it and drops
# the result, which MSVC's standard library marks [[nodiscard]]
target_compile_options(fmt PRIVATE /wd4834)
endif()
else()
find_package(fmt 8 REQUIRED)
endif()