From ab107b3fac7e837fa63ca020b98ada0d7c0ca556 Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Tue, 14 Mar 2023 15:03:22 -0500 Subject: [PATCH] [libc] Fix CMake deduplication `-Xclang` arguments Summary: We use `-Xclang` to pass the GPU binary to be embedded. In the case of multi-source objects this will be passed more than once, but CMake implicitly deduplicates arguments. Use the special generator to prevent this from happening. --- libc/cmake/modules/LLVMLibCObjectRules.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libc/cmake/modules/LLVMLibCObjectRules.cmake b/libc/cmake/modules/LLVMLibCObjectRules.cmake index 0630cf5..e97a6a4 100644 --- a/libc/cmake/modules/LLVMLibCObjectRules.cmake +++ b/libc/cmake/modules/LLVMLibCObjectRules.cmake @@ -173,9 +173,11 @@ function(_build_gpu_objects fq_target_name internal_target_name) target_compile_options(${fq_target_name} BEFORE PRIVATE ${common_compile_options} -nostdlib) foreach(packaged_gpu_binary ${packaged_gpu_binaries}) + message(STATUS ${packaged_gpu_binary}) target_compile_options(${fq_target_name} PRIVATE - -Xclang -fembed-offload-object=${packaged_gpu_binary}) + "SHELL:-Xclang -fembed-offload-object=${packaged_gpu_binary}") endforeach() + message(STATUS "\n") target_include_directories(${fq_target_name} PRIVATE ${include_dirs}) add_dependencies(${fq_target_name} ${full_deps_list} ${packaged_gpu_names} ${stub_target_name}) -- 2.7.4