meson/MSVC builds: Use -utf-8 where available

This avoids the build from erroring out on C4819 (Unicode handling issue in
Visual Studio compiler), notably when running on Chinese, Japanese and
Korean locales.
This commit is contained in:
Chun-wei Fan
2020-01-15 15:27:59 +08:00
parent 0cbeee3857
commit 55f46809de

View File

@@ -275,9 +275,12 @@ endif
if cc.get_id() == 'msvc'
# Compiler options taken from msvc_recommended_pragmas.h
# in GLib, based on _Win32_Programming_ by Rector and Newcomer
test_cflags = []
add_project_arguments('-FImsvc_recommended_pragmas.h', language: 'c')
add_project_arguments('-D_USE_MATH_DEFINES', language: 'c')
test_cflags = [
'-FImsvc_recommended_pragmas.h',
'-D_USE_MATH_DEFINES',
'-utf-8',
]
add_project_arguments(cc.get_supported_arguments(test_cflags), language: 'c')
elif cc.get_id() == 'gcc' or cc.get_id() == 'clang'
test_cflags = [
'-fno-strict-aliasing',