Build nolocale-test with /utf-8 on MSVC (#4919)

nolocale-test compiles src/format.cc directly, so it does not pick up the
/utf-8 that CMakeLists.txt adds to the fmt target. On MSVC the static_assert
in base.h then fires: "Unicode support requires compiling with /utf-8".

The target only exists under FMT_PEDANTIC, which the Windows workflow does not
set, so this has not shown up in CI. unicode-test already guards the same flag
the same way.
This commit is contained in:
Ethan Stoner 2026-09-06 13:46:11 -07:00 committed by GitHub
parent 8be4b46114
commit 2d4d8a13c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -134,6 +134,8 @@ if (FMT_PEDANTIC)
PRIVATE ${PROJECT_SOURCE_DIR}/include)
target_compile_definitions(nolocale-test
PRIVATE FMT_STATIC_THOUSANDS_SEPARATOR=1)
target_compile_options(nolocale-test
PRIVATE $<$<CXX_COMPILER_ID:MSVC>:/utf-8>)
endif ()
# These tests are disabled on Windows because they take too long.