diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt --- a/llvm/runtimes/CMakeLists.txt +++ b/llvm/runtimes/CMakeLists.txt @@ -183,6 +183,10 @@ 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)