[llvm] CMake: Force MSVC to read code as UTF-8
authorKirill Bobyrev <kbobyrev@google.com>
Mon, 9 Nov 2020 21:47:16 +0000 (22:47 +0100)
committerKirill Bobyrev <kbobyrev@google.com>
Mon, 9 Nov 2020 21:47:22 +0000 (22:47 +0100)
Symptoms: https://github.com/clangd/clangd/issues/571

Reviewed By: kadircet

Differential Revision: https://reviews.llvm.org/D90116

llvm/CMakeLists.txt

index 21563e1..0c9c4cd 100644 (file)
@@ -599,6 +599,8 @@ if(MSVC)
   if (BUILD_SHARED_LIBS)
     message(FATAL_ERROR "BUILD_SHARED_LIBS options is not supported on Windows.")
   endif()
+  # Force MSVC to read code as UTF-8.
+  add_compile_options(/utf-8)
 else()
   option(LLVM_LINK_LLVM_DYLIB "Link tools against the libllvm dynamic library" OFF)
   option(LLVM_BUILD_LLVM_C_DYLIB "Build libllvm-c re-export library (Darwin only)" OFF)