From 6f06265e86c910b32fb31d23954a186c86d9ef1f Mon Sep 17 00:00:00 2001 From: ZJUGKC Date: Sun, 20 Mar 2022 15:45:08 +0800 Subject: 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. --- CMake/setup.cmake | 1 + 1 file changed, 1 insertion(+) (limited to 'CMake/setup.cmake') diff --git a/CMake/setup.cmake b/CMake/setup.cmake index 434697993..8a7545f12 100644 --- a/CMake/setup.cmake +++ b/CMake/setup.cmake @@ -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) -- cgit v1.2.3