[PATCH] D143557: [CMake][compiler-rt] Support clang-cl in CompilerRTMockLLVMCMakeConfig
Tobias Hieta via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 8 00:30:34 PST 2023
thieta created this revision.
thieta added reviewers: phosek, ldionne, delcypher, thetruestblue.
Herald added subscribers: Enna1, dberris.
Herald added a project: All.
thieta requested review of this revision.
Herald added a project: Sanitizers.
Herald added a subscriber: Sanitizers.
clang-cl doesn't support -dumpmachine directly, so we need to
preface it with /clang: in order to get this probing function
to work.
This is needed in order to run cmake directly on the runtimes
directory.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D143557
Files:
compiler-rt/cmake/Modules/CompilerRTMockLLVMCMakeConfig.cmake
Index: compiler-rt/cmake/Modules/CompilerRTMockLLVMCMakeConfig.cmake
===================================================================
--- compiler-rt/cmake/Modules/CompilerRTMockLLVMCMakeConfig.cmake
+++ compiler-rt/cmake/Modules/CompilerRTMockLLVMCMakeConfig.cmake
@@ -46,8 +46,14 @@
if ("${CMAKE_C_COMPILER_ID}" MATCHES "Clang|GNU")
# Note: Clang also supports `-print-target-triple` but gcc doesn't
# support this flag.
+ set(DUMPMACHINE_ARG -dumpmachine)
+ if(MSVC)
+ # This means we are using clang-cl and it requires
+ # /clang: as prefix for dumpmachine argument.
+ set(DUMPMACHINE_ARG /clang:-dumpmachine)
+ endif()
execute_process(
- COMMAND "${CMAKE_C_COMPILER}" -dumpmachine
+ COMMAND "${CMAKE_C_COMPILER}" ${DUMPMACHINE_ARG}
RESULT_VARIABLE HAD_ERROR
OUTPUT_VARIABLE COMPILER_OUTPUT
OUTPUT_STRIP_TRAILING_WHITESPACE)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143557.495748.patch
Type: text/x-patch
Size: 935 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230208/3e687dd9/attachment.bin>
More information about the llvm-commits
mailing list