[libclc][CMake] Remove CMAKE_C_COMPILER_ID check (#186717)

When LLVM_TARGETS_TO_BUILD does not contain the host target, runtime
build can not identify a compatible target triple for the host compiler.
CMAKE_C_COMPILER is set to clang, and CMAKE_C_COMPILER_ID is empty
although the compiler is functional.

Remove CMAKE_C_COMPILER_ID check. CMakeTestCLCCompiler.cmake already
provides a real functional guard.

This change ensures valid configurations can proceed, e.g.:
LLVM_TARGETS_TO_BUILD=AMDGPU;
RUNTIMES_amdgcn-amd-amdhsa-llvm_LLVM_ENABLE_RUNTIMES=libclc;
LLVM_RUNTIME_TARGETS="amdgcn-amd-amdhsa-llvm".

Note CMAKE_C_COMPILER_WORKS is always true after `project(Runtimes C CXX
ASM)` in runtimes/CMakeLists.txt.
This commit is contained in:
Wenju He
2026-04-24 08:45:51 +08:00
committed by GitHub
parent a95a1c40ed
commit f3192382c3

View File

@@ -1,9 +1,4 @@
if(NOT CMAKE_CLC_COMPILER)
if(NOT CMAKE_C_COMPILER_ID MATCHES "Clang")
message(FATAL_ERROR
"The CLC language requires the C compiler (CMAKE_C_COMPILER) to be "
"Clang, but CMAKE_C_COMPILER_ID is '${CMAKE_C_COMPILER_ID}'.")
endif()
set(CMAKE_CLC_COMPILER "${CMAKE_C_COMPILER}" CACHE FILEPATH "CLC compiler")
endif()