Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

Add MSVC Support For UTF-8 (#28278)

Xiake Suneaad9a873b8c
diff --git a/cmake/developer_package/compile_flags/os_flags.cmake b/cmake/developer_package/compile_flags/os_flags.cmake
index e70de45b941..7c50f6f6e7e 100644
--- a/cmake/developer_package/compile_flags/os_flags.cmake
+++ b/cmake/developer_package/compile_flags/os_flags.cmake
@@ -449,6 +449,10 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# Build with multiple processes
ov_add_compiler_flags(/MP)
+ # Specifies both the source character set and the execution character set as UTF-8.
+ # For details, refer to link: https://learn.microsoft.com/en-us/cpp/build/reference/utf-8-set-source-and-executable-character-sets-to-utf-8?view=msvc-170
+ ov_add_compiler_flags(/utf-8)
+
# Workaround for an MSVC compiler issue in some versions of Visual Studio 2022.
# The issue involves a null dereference to a mutex. For details, refer to link https://github.com/microsoft/STL/wiki/Changelog#vs-2022-1710
if(MSVC AND MSVC_VERSION GREATER_EQUAL 1930)