From dbed326a5806118066955fd96bf5cb43b96aca47 Mon Sep 17 00:00:00 2001 From: Plane Date: Thu, 10 Feb 2022 04:22:07 -0800 Subject: [PATCH] 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. --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f21d2df27..011b3ee97 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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)