[llvm] 4d81c8a - [llvm] CMake: Force MSVC to read code as UTF-8

Kirill Bobyrev via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 9 13:47:37 PST 2020


Author: Kirill Bobyrev
Date: 2020-11-09T22:47:22+01:00
New Revision: 4d81c8adb6ed9840257f6cb6b93f60856d422a15

URL: https://github.com/llvm/llvm-project/commit/4d81c8adb6ed9840257f6cb6b93f60856d422a15
DIFF: https://github.com/llvm/llvm-project/commit/4d81c8adb6ed9840257f6cb6b93f60856d422a15.diff

LOG: [llvm] CMake: Force MSVC to read code as UTF-8

Symptoms: https://github.com/clangd/clangd/issues/571

Reviewed By: kadircet

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

Added: 
    

Modified: 
    llvm/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index 21563e151180..0c9c4cd1969b 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -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)


        


More information about the llvm-commits mailing list