[PATCH] D143557: [CMake][compiler-rt] Support clang-cl in CompilerRTMockLLVMCMakeConfig

Tobias Hieta via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 10 05:33:09 PST 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG8ccde9368f94: [CMake][compiler-rt] Support clang-cl in CompilerRTMockLLVMCMakeConfig (authored by thieta).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143557/new/

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.496439.patch
Type: text/x-patch
Size: 935 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230210/3fe2364c/attachment.bin>


More information about the llvm-commits mailing list