[compiler-rt] Fix CMake configure on Windows (#90843)

CMake configure compiler-rt got broken as a result of following commit:
d3925e65a7

This patch fixes the break by porting the above commit for clang-cl.

This problem was not caught on Windows buildbots beacuase it appeared
when compiler-rt was included via LLVM_ENABLE_PROJECTS while buildbots
include compiler-rt project using LLVM_ENABLE_RUNTIMES flag.
This commit is contained in:
Omair Javaid
2024-05-02 18:27:23 +05:00
committed by GitHub
parent c129887817
commit 33e16cae67

View File

@@ -369,7 +369,11 @@ macro(construct_compiler_rt_default_triple)
endif()
if ("${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
execute_process(COMMAND ${CMAKE_C_COMPILER} --target=${COMPILER_RT_DEFAULT_TARGET_TRIPLE} -print-target-triple
set(option_prefix "")
if (CMAKE_C_SIMULATE_ID MATCHES "MSVC")
set(option_prefix "/clang:")
endif()
execute_process(COMMAND ${CMAKE_C_COMPILER} ${option_prefix}--target=${COMPILER_RT_DEFAULT_TARGET_TRIPLE} ${option_prefix}-print-target-triple
OUTPUT_VARIABLE COMPILER_RT_DEFAULT_TARGET_TRIPLE
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()