From ab7f694b71497d216e1e7bad50bb4471feee7652 Mon Sep 17 00:00:00 2001 From: Gaolingx <947770192@qq.com> Date: Sat, 3 May 2025 20:56:29 +0800 Subject: [PATCH] cmake: force MSVC compiler charset to utf-8 (#369) --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) 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("$<$:/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 #