[compiler-rt] [llvm] [Runtimes] Fix /clang: prefix warning for GNU-like clang on Windows (PR #192041)
Wenju He via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 14 04:58:28 PDT 2026
https://github.com/wenju-he created https://github.com/llvm/llvm-project/pull/192041
libclc has configure warning on Windows:
clang: error: no such file or directory: '/clang:--target=amdgcn-amd-amdhsa-llvm' clang: error: no such file or directory: '/clang:-print-target-triple'
CMake Warning at CMakeLists.txt:239 (message):
Failed to execute `llvm-project/build/bin/clang.exe
/clang:--target=amdgcn-amd-amdhsa-llvm /clang:-print-target-triple` to
normalize target triple.
Switch to check CMAKE_C_COMPILER_FRONTEND_VARIANT because
CMAKE_C_SIMULATE_ID=MSVC: true for both clang and clang-cl.
CMAKE_C_COMPILER_FRONTEND_VARIANT=MSVC: true for clang-cl; false for clang.
>From 5805f4f7758bd1e70a1eed5734ba5804ad622ff0 Mon Sep 17 00:00:00 2001
From: Wenju He <wenju.he at intel.com>
Date: Tue, 14 Apr 2026 13:47:14 +0200
Subject: [PATCH] [Runtimes] Fix /clang: prefix warning for GNU-like clang on
Windows
libclc has configure warning on Windows:
clang: error: no such file or directory: '/clang:--target=amdgcn-amd-amdhsa-llvm'
clang: error: no such file or directory: '/clang:-print-target-triple'
CMake Warning at CMakeLists.txt:239 (message):
Failed to execute `llvm-project/build/bin/clang.exe
/clang:--target=amdgcn-amd-amdhsa-llvm /clang:-print-target-triple` to
normalize target triple.
Switch to check CMAKE_C_COMPILER_FRONTEND_VARIANT because
CMAKE_C_SIMULATE_ID=MSVC: true for both clang and clang-cl.
CMAKE_C_COMPILER_FRONTEND_VARIANT=MSVC: true for clang-cl; false for clang.
---
compiler-rt/cmake/Modules/CompilerRTUtils.cmake | 2 +-
runtimes/CMakeLists.txt | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
index a8757acce7f5a..0a11dc7e194bc 100644
--- a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
+++ b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
@@ -389,7 +389,7 @@ macro(construct_compiler_rt_default_triple)
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
set(option_prefix "")
- if (CMAKE_C_SIMULATE_ID MATCHES "MSVC")
+ if (CMAKE_C_COMPILER_FRONTEND_VARIANT MATCHES "MSVC")
set(option_prefix "/clang:")
endif()
set(print_target_triple ${CMAKE_C_COMPILER} ${option_prefix}--target=${COMPILER_RT_DEFAULT_TARGET_TRIPLE} ${option_prefix}-print-target-triple)
diff --git a/runtimes/CMakeLists.txt b/runtimes/CMakeLists.txt
index eba41b8b10ac4..7f1d9a20bd19b 100644
--- a/runtimes/CMakeLists.txt
+++ b/runtimes/CMakeLists.txt
@@ -223,7 +223,7 @@ set(LLVM_TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}")
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
set(option_prefix "")
- if (CMAKE_C_SIMULATE_ID MATCHES "MSVC")
+ if (CMAKE_C_COMPILER_FRONTEND_VARIANT MATCHES "MSVC")
set(option_prefix "/clang:")
endif()
set(print_target_triple ${CMAKE_C_COMPILER} ${option_prefix}--target=${LLVM_DEFAULT_TARGET_TRIPLE} ${option_prefix}-print-target-triple)
More information about the llvm-commits
mailing list