summaryrefslogtreecommitdiffstats
path: root/Modules/FindCUDAToolkit.cmake
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2020-01-06 14:01:04 (GMT)
committerRobert Maynard <robert.maynard@kitware.com>2020-01-06 14:11:16 (GMT)
commit907bb7df57528e91a0dbcab331dfd9f07f28b660 (patch)
tree5a903e35a5e4e78df707caa8c61327c463b4f793 /Modules/FindCUDAToolkit.cmake
parente500eb80cd3fcd6f512d7d69ba7218a1b532c6fe (diff)
downloadCMake-907bb7df57528e91a0dbcab331dfd9f07f28b660.zip
CMake-907bb7df57528e91a0dbcab331dfd9f07f28b660.tar.gz
CMake-907bb7df57528e91a0dbcab331dfd9f07f28b660.tar.bz2
CUDAToolkit: Gracefully handle missing SDK components
Diffstat (limited to 'Modules/FindCUDAToolkit.cmake')
-rw-r--r--Modules/FindCUDAToolkit.cmake15
1 files changed, 8 insertions, 7 deletions
diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake
index 44f4951..16ad991 100644
--- a/Modules/FindCUDAToolkit.cmake
+++ b/Modules/FindCUDAToolkit.cmake
@@ -708,9 +708,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)
@@ -742,9 +746,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})
@@ -777,7 +778,7 @@ if(CUDAToolkit_FOUND)
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()