[compiler-rt] [compiler-rt] Fix CMake configure on Windows (PR #90843)
Omair Javaid via llvm-commits
llvm-commits at lists.llvm.org
Thu May 2 03:47:07 PDT 2024
https://github.com/omjavaid updated https://github.com/llvm/llvm-project/pull/90843
>From b1ef7187e31d6e7b8fc17bec0d8c852f9486a709 Mon Sep 17 00:00:00 2001
From: Muhammad Omair Javaid <omair.javaid at linaro.org>
Date: Thu, 2 May 2024 13:27:48 +0500
Subject: [PATCH 1/2] [compiler-rt] Fix CMake configure on Windows
CMake configure compiler-rt got broken as a result of following commit:
d3925e65a7ab88eb0ba68d3ab79cd95db5629951
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.
---
compiler-rt/cmake/Modules/CompilerRTUtils.cmake | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
index a6c6ef93500d53..240c9837b2d201 100644
--- a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
+++ b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
@@ -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(cmd_prefix "")
+ if (CMAKE_C_SIMULATE_ID MATCHES "MSVC")
+ set(cmd_prefix "/clang:")
+ endif()
+ execute_process(COMMAND ${CMAKE_C_COMPILER} ${cmd_prefix}--target=${COMPILER_RT_DEFAULT_TARGET_TRIPLE} ${cmd_prefix}-print-target-triple
OUTPUT_VARIABLE COMPILER_RT_DEFAULT_TARGET_TRIPLE
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
>From e53230696c2b311a59f13b6d1913fb44fc629709 Mon Sep 17 00:00:00 2001
From: Omair Javaid <omairjavaid at gmail.com>
Date: Thu, 2 May 2024 15:46:58 +0500
Subject: [PATCH 2/2] Update CompilerRTUtils.cmake
---
compiler-rt/cmake/Modules/CompilerRTUtils.cmake | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
index 240c9837b2d201..8e331634b76bd0 100644
--- a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
+++ b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
@@ -369,11 +369,11 @@ macro(construct_compiler_rt_default_triple)
endif()
if ("${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
- set(cmd_prefix "")
+ set(option_prefix "")
if (CMAKE_C_SIMULATE_ID MATCHES "MSVC")
- set(cmd_prefix "/clang:")
+ set(option_prefix "/clang:")
endif()
- execute_process(COMMAND ${CMAKE_C_COMPILER} ${cmd_prefix}--target=${COMPILER_RT_DEFAULT_TARGET_TRIPLE} ${cmd_prefix}-print-target-triple
+ 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()
More information about the llvm-commits
mailing list