[libclc] [libclc] Add custom CMake language handling for OpenCL files (PR #185243)

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 7 20:05:25 PST 2026


================
@@ -0,0 +1,34 @@
+if(CMAKE_CLC_COMPILER_FORCED)
+  set(CMAKE_CLC_COMPILER_WORKS TRUE)
+  return()
+endif()
+
+set(_test_file "${CMAKE_CURRENT_LIST_DIR}/CMakeCLCCompilerTest.cl")
+set(_test_dir "${CMAKE_PLATFORM_INFO_DIR}/CMakeTmp")
+set(_test_out "${_test_dir}/test_clc.o")
+file(MAKE_DIRECTORY "${_test_dir}")
+
+message(STATUS "Check for working CLC compiler: ${CMAKE_CLC_COMPILER}")
+
+execute_process(
+  COMMAND "${CMAKE_CLC_COMPILER}" -x cl -c -flto
----------------
jhuber6 wrote:

This is intentionally weak, we cannot do a full source-to-binary test as targets like NVPTX require external binaries the user might not have. Compiling OpenCL to LLVM-IR is a compromise.

https://github.com/llvm/llvm-project/pull/185243


More information about the cfe-commits mailing list