[libc-commits] [libc] [llvm] [libc] Use CMAKE_CROSSCOMPILING_EMULATOR instead searching for `llvm-gpu-loader' (PR #189417)

Petr Hosek via libc-commits libc-commits at lists.llvm.org
Wed Apr 1 01:00:21 PDT 2026


================
@@ -66,22 +66,14 @@ else()
 endif()
 set(LIBC_GPU_TARGET_ARCHITECTURE "${gpu_test_architecture}")
 
-# Identify the GPU loader utility used to run tests.
-set(LIBC_GPU_LOADER_EXECUTABLE "" CACHE STRING "Executable for the GPU loader.")
-if(LIBC_GPU_LOADER_EXECUTABLE)
-  set(gpu_loader_executable ${LIBC_GPU_LOADER_EXECUTABLE})
-else()
+# Search for the loader utility if the user did not provide one.
+if(NOT CMAKE_CROSSCOMPILING_EMULATOR)
   find_program(gpu_loader_executable
                NAMES llvm-gpu-loader NO_DEFAULT_PATH
                PATHS ${LLVM_BINARY_DIR}/bin ${compiler_path})
-endif()
-if(NOT TARGET libc.utils.gpu.loader AND gpu_loader_executable)
-  add_custom_target(libc.utils.gpu.loader)
-  set_target_properties(
-    libc.utils.gpu.loader
-    PROPERTIES
-      EXECUTABLE "${gpu_loader_executable}"
-  )
+  if(gpu_loader_executable)
+    set(CMAKE_CROSSCOMPILING_EMULATOR "${gpu_loader_executable}" CACHE STRING "")
----------------
petrhosek wrote:

I'm fine merging this as is, just be aware of the potential issue in case people start using the `CROSSCOMPILING_EMULATOR` property on individual targets.

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


More information about the libc-commits mailing list