[clang] 759dec2 - [nvptx-arch] Remove `find_package(CUDA)` as it has been deprecated.
Joseph Huber via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 25 11:58:10 PST 2023
Author: Joseph Huber
Date: 2023-01-25T13:58:00-06:00
New Revision: 759dec253695f38a101c74905c819ea47392e515
URL: https://github.com/llvm/llvm-project/commit/759dec253695f38a101c74905c819ea47392e515
DIFF: https://github.com/llvm/llvm-project/commit/759dec253695f38a101c74905c819ea47392e515.diff
LOG: [nvptx-arch] Remove `find_package(CUDA)` as it has been deprecated.
Since D137724 and the LLVM 17 release we have updated to CMake version
3.20. This means we can use `find_package(CUDAToolkit)` instead as the
legacy module is deprecated.
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D142570
Added:
Modified:
clang/tools/nvptx-arch/CMakeLists.txt
Removed:
################################################################################
diff --git a/clang/tools/nvptx-arch/CMakeLists.txt b/clang/tools/nvptx-arch/CMakeLists.txt
index 9b31cdd772dcf..95c25dc75847e 100644
--- 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()
More information about the cfe-commits
mailing list