[libc-commits] [libc] ab107b3 - [libc] Fix CMake deduplication `-Xclang` arguments

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Tue Mar 14 13:04:50 PDT 2023


Author: Joseph Huber
Date: 2023-03-14T15:04:37-05:00
New Revision: ab107b3fac7e837fa63ca020b98ada0d7c0ca556

URL: https://github.com/llvm/llvm-project/commit/ab107b3fac7e837fa63ca020b98ada0d7c0ca556
DIFF: https://github.com/llvm/llvm-project/commit/ab107b3fac7e837fa63ca020b98ada0d7c0ca556.diff

LOG: [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.

Added: 
    

Modified: 
    libc/cmake/modules/LLVMLibCObjectRules.cmake

Removed: 
    


################################################################################
diff  --git a/libc/cmake/modules/LLVMLibCObjectRules.cmake b/libc/cmake/modules/LLVMLibCObjectRules.cmake
index 0630cf598e88..e97a6a4281fc 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})


        


More information about the libc-commits mailing list