Tell MSVC source files are in UTF-8 format

On some locales (e.g. Japanese) MSVC will fail to build Furnace
because it makes an incorrect assumption about the encoding of
source files.  In particular, string literals in engine.cpp cause
compile errors.  This probably doesn't show up in CI because of
the difference in locale.

This patch adds the `/source-charset:utf-8` compiler flag for MSVC,
which tells it the encoding of the source files.

With this change, MSVC appears to build Furnace properly.  Tested
with Visual Studio Professional 2022.
This commit is contained in:
Plane 2022-02-10 04:22:07 -08:00 committed by tildearrow
parent f56d771a4d
commit dbed326a58
1 changed files with 1 additions and 0 deletions

View File

@ -339,6 +339,7 @@ if (NOT MSVC)
endif()
else()
# /wd4100 == -Wno-unused-parameter
add_compile_options("/source-charset:utf-8")
set(WARNING_FLAGS /W4 /wd4100 /D_CRT_SECURE_NO_WARNINGS)
if (WARNINGS_ARE_ERRORS)
list(APPEND WARNING_FLAGS /WX)