cmake: force MSVC compiler charset to utf-8 (#9989)

This commit is contained in:
蕭澧邦 2024-11-20 01:42:00 +08:00 committed by GitHub
parent 2a11b6b094
commit 342397dc7e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -46,6 +46,13 @@ if (WIN32)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
endif()
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
#