[PATCH] D157986: [Cmake] Make sure MSVC knows LLVM source files are UTF-8 encoded
Corentin Jabot via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 15 07:50:01 PDT 2023
cor3ntin created this revision.
Herald added a subscriber: ekilmer.
Herald added a project: All.
cor3ntin requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
By default, MSVC assumes source files are encoded with the user
locale's encoding, which can cause build failures.
GCC always use UTF-8 by default and doesn't need change.
Fixes #64668
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D157986
Files:
llvm/cmake/modules/HandleLLVMOptions.cmake
Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===================================================================
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -489,6 +489,9 @@
_UNICODE
)
+ # Tell MSVC the LLVM sources are UTF-8 encoded.
+ append("/source-charset:utf-8" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+
if (LLVM_WINSYSROOT)
if (NOT CLANG_CL)
message(ERROR "LLVM_WINSYSROOT requires clang-cl")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157986.550332.patch
Type: text/x-patch
Size: 476 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230815/f6730a9f/attachment.bin>
More information about the llvm-commits
mailing list