From 9b56c3623ff5779f2eb329c9cd3eea03d1db74d2 Mon Sep 17 00:00:00 2001 From: Gaolingx <947770192@qq.com> Date: Sat, 3 May 2025 19:18:37 +0800 Subject: [PATCH] cmake: force MSVC compiler charset to utf-8 --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index cb59656ed..10049391e 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("$<$:/source-charset:utf-8>") + add_compile_options("$<$:/source-charset:utf-8>") + add_compile_options("$<$:/execution-charset:utf-8>") + add_compile_options("$<$:/execution-charset:utf-8>") +endif() + # # option list #