summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorGaolingx <947770192@qq.com>2025-05-03 20:56:29 +0800
committerGitHub <noreply@github.com>2025-05-03 15:56:29 +0300
commitab7f694b71497d216e1e7bad50bb4471feee7652 (patch)
treee354a031f815c3d25563148a2316f71b8e7c2b2b /CMakeLists.txt
parentafcfa85756ec7a476ed1daf79ed4152625dd8c7c (diff)
cmake: force MSVC compiler charset to utf-8 (#369)
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt8
1 files changed, 8 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cb59656e..10049391 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -53,6 +53,14 @@ if (WIN32)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
endif()
+# force MSVC compiler charset to utf-8
+if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
+ add_compile_options("$<$<COMPILE_LANGUAGE:C>:/source-charset:utf-8>")
+ add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:/source-charset:utf-8>")
+ add_compile_options("$<$<COMPILE_LANGUAGE:C>:/execution-charset:utf-8>")
+ add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:/execution-charset:utf-8>")
+endif()
+
#
# option list
#