Browse Source

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.
pull/424/head
ZJUGKC 3 years ago committed by Albrecht Schlosser
parent
commit
6f06265e86
  1. 1
      CMake/setup.cmake

1
CMake/setup.cmake

@ -116,6 +116,7 @@ if (WIN32)
if (MSVC) if (MSVC)
add_definitions (-DWIN32_LEAN_AND_MEAN) add_definitions (-DWIN32_LEAN_AND_MEAN)
add_definitions (-D_CRT_SECURE_NO_WARNINGS) 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) set (BORDER_WIDTH 2)
endif (MSVC) endif (MSVC)
if (CMAKE_C_COMPILER_ID STREQUAL GNU) if (CMAKE_C_COMPILER_ID STREQUAL GNU)

Loading…
Cancel
Save