diff options
author | Brad King <brad.king@kitware.com> | 2020-01-15 18:39:58 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-01-15 18:40:07 (GMT) |
commit | 9f1ce93d92ec33e879ef593de021d0b577de6c68 (patch) | |
tree | 8ffaad9b08ce4ac009d89a4bf0bddbaa3f89a49a /Modules | |
parent | 6c23cbca371bb37a6de34b2e0d6fc795632da08b (diff) | |
parent | 6e474364d19566d211aefed003840be15cba940e (diff) | |
download | CMake-9f1ce93d92ec33e879ef593de021d0b577de6c68.zip CMake-9f1ce93d92ec33e879ef593de021d0b577de6c68.tar.gz CMake-9f1ce93d92ec33e879ef593de021d0b577de6c68.tar.bz2 |
Merge topic 'add_cuda_toolkit_tests'
6e474364d1 CUDAToolkit: No targets now depend on the CUDA runtime
907bb7df57 CUDAToolkit: Gracefully handle missing SDK components
e500eb80cd CUDAToolkit: add_cuda_link_dependency correctly sets dependencies
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4183
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindCUDAToolkit.cmake | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake index 1837694..f7f68ca 100644 --- a/Modules/FindCUDAToolkit.cmake +++ b/Modules/FindCUDAToolkit.cmake @@ -122,7 +122,6 @@ CUDA Runtime Library The CUDA Runtime library (cudart) are what most applications will typically need to link against to make any calls such as `cudaMalloc`, and `cudaFree`. -They are an explicit dependency of almost every library. Targets Created: @@ -708,9 +707,13 @@ if(CUDAToolkit_FOUND) endfunction() function(add_cuda_link_dependency lib_name) - foreach(dependency IN LISTS ${ARGN}) - target_link_libraries(CUDA::${lib_name} INTERFACE CUDA::${dependency}) - endforeach() + if(TARGET CUDA::${lib_name}) + foreach(dependency IN LISTS ARGN) + if(TARGET CUDA::${dependency}) + target_link_libraries(CUDA::${lib_name} INTERFACE CUDA::${dependency}) + endif() + endforeach() + endif() endfunction() add_library(CUDA::toolkit IMPORTED INTERFACE) @@ -725,10 +728,8 @@ if(CUDAToolkit_FOUND) foreach (cuda_lib cublas cufft cufftw curand cusolver cusparse nvgraph nvjpeg) find_and_add_cuda_import_lib(${cuda_lib}) - add_cuda_link_dependency(${cuda_lib} cudart) find_and_add_cuda_import_lib(${cuda_lib}_static) - add_cuda_link_dependency(${cuda_lib}_static cudart_static) endforeach() # cuSOLVER depends on cuBLAS, and cuSPARSE @@ -742,9 +743,6 @@ if(CUDAToolkit_FOUND) find_and_add_cuda_import_lib(nppc) find_and_add_cuda_import_lib(nppc_static) - add_cuda_link_dependency(nppc cudart) - add_cuda_link_dependency(nppc_static cudart_static culibos) - # Process the majority of the NPP libraries. foreach (cuda_lib nppial nppicc nppidei nppif nppig nppim nppist nppitc npps nppicom nppisu) find_and_add_cuda_import_lib(${cuda_lib}) @@ -771,13 +769,11 @@ if(CUDAToolkit_FOUND) endif() find_and_add_cuda_import_lib(nvToolsExt nvToolsExt nvToolsExt64) - add_cuda_link_dependency(nvToolsExt cudart) - find_and_add_cuda_import_lib(OpenCL) find_and_add_cuda_import_lib(culibos) if(TARGET CUDA::culibos) - foreach (cuda_lib cublas cufft cusparse curand nvjpeg) + foreach (cuda_lib cublas cufft cusparse curand nppc nvjpeg) add_cuda_link_dependency(${cuda_lib}_static culibos) endforeach() endif() |