[libc] Forward CUDA options to the runtimes invocation of `libc`
authorJoseph Huber <jhuber6@vols.utk.edu>
Tue, 4 Apr 2023 23:32:00 +0000 (18:32 -0500)
committerJoseph Huber <jhuber6@vols.utk.edu>
Wed, 5 Apr 2023 00:50:34 +0000 (19:50 -0500)
Some configurations may require `-DCUDAToolkit_ROOT` to find CUDA
properly. This is currently not forwarded to the CMake invocation. This
patch adds a prefix so it will be visible when the runtimes build is
started.

Reviewed By: tra

Differential Revision: https://reviews.llvm.org/D147582

llvm/runtimes/CMakeLists.txt

index f4c697e..cc5f530 100644 (file)
@@ -183,6 +183,10 @@ foreach(entry ${runtimes})
   if(canon_name STREQUAL "LIBC")
     list(APPEND prefixes "LLVM_LIBC")
     list(APPEND prefixes "LIBC_")
+    # The `libc` project may require '-DCUDAToolkit_ROOT' in GPU mode.
+    if(LIBC_GPU_BUILD OR LIBC_GPU_ARCHITECTURES)
+      list(APPEND prefixes "CUDA")
+    endif()
   endif()
 
   string(FIND ${projName} "lib" LIB_IDX)