diff --git a/clang/tools/nvptx-arch/CMakeLists.txt b/clang/tools/nvptx-arch/CMakeLists.txt --- a/clang/tools/nvptx-arch/CMakeLists.txt +++ b/clang/tools/nvptx-arch/CMakeLists.txt @@ -9,18 +9,11 @@ set(LLVM_LINK_COMPONENTS Support) add_clang_tool(nvptx-arch NVPTXArch.cpp) -# TODO: This is deprecated. Since CMake 3.17 we can use FindCUDAToolkit instead. -find_package(CUDA QUIET) -find_library(cuda-library NAMES cuda PATHS /lib64) -if (NOT cuda-library AND CUDA_FOUND) - get_filename_component(CUDA_LIBDIR "${CUDA_cudart_static_LIBRARY}" DIRECTORY) - find_library(cuda-library NAMES cuda HINTS "${CUDA_LIBDIR}/stubs") -endif() +find_package(CUDAToolkit QUIET) # If we found the CUDA library directly we just dynamically link against it. -if (CUDA_FOUND AND cuda-library) - target_include_directories(nvptx-arch PRIVATE ${CUDA_INCLUDE_DIRS}) - target_link_libraries(nvptx-arch PRIVATE ${cuda-library}) +if (CUDAToolkit_FOUND) + target_link_libraries(nvptx-arch PRIVATE CUDA::cuda_driver) else() target_compile_definitions(nvptx-arch PRIVATE "DYNAMIC_CUDA") endif()