diff options
| author | ZJUGKC <yxxinyuan@zju.edu.cn> | 2022-03-20 15:45:08 +0800 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2022-03-26 18:00:50 +0100 |
| commit | 6f06265e86c910b32fb31d23954a186c86d9ef1f (patch) | |
| tree | 515166c99ec0291036bca4bf3515cbc7b695ece8 /CMake/setup.cmake | |
| parent | e9b1c2fed092c9952464cc7999bf4a5c27ab250b (diff) | |
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.
Diffstat (limited to 'CMake/setup.cmake')
| -rw-r--r-- | CMake/setup.cmake | 1 |
1 files changed, 1 insertions, 0 deletions
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) |
