Add UTF-8 encoding support in setup.cmake for MSVC (PR #415)

The source files are all encoded by UTF-8 without BOM. This will raise
warnings and errors when compiling by the MSVC with some active code
pages (ACP). The file `test/ask.cxx` contains such characters with UTF-8
encoding. Adding `/utf-8` here is equivalent to specifying
`/source-charset:utf-8 /execution-charset:utf-8`, and all warnings and
errors are removed.
This commit is contained in:
ZJUGKC 2022-03-20 15:45:08 +08:00 committed by Albrecht Schlosser
parent e9b1c2fed0
commit 6f06265e86

View File

@ -116,6 +116,7 @@ if (WIN32)
if (MSVC)
add_definitions (-DWIN32_LEAN_AND_MEAN)
add_definitions (-D_CRT_SECURE_NO_WARNINGS)
add_compile_options (/utf-8) # This is equivalent to specifying `/source-charset:utf-8 /execution-charset:utf-8`
set (BORDER_WIDTH 2)
endif (MSVC)
if (CMAKE_C_COMPILER_ID STREQUAL GNU)