diff --git a/compiler-rt/cmake/Modules/CompilerRTMockLLVMCMakeConfig.cmake b/compiler-rt/cmake/Modules/CompilerRTMockLLVMCMakeConfig.cmake --- a/compiler-rt/cmake/Modules/CompilerRTMockLLVMCMakeConfig.cmake +++ b/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)