summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Maynard <rmaynard@nvidia.com>2022-11-17 18:41:11 (GMT)
committerRobert Maynard <rmaynard@nvidia.com>2022-11-17 18:41:11 (GMT)
commitc7ece269daaaa2275c29c99f97c6e13999ec2fc2 (patch)
treeb04e621996ded13da7ee4f651ebe176495729a11
parent13e46189c7f3b39a26e9ca689bc029b7061d26a7 (diff)
downloadCMake-c7ece269daaaa2275c29c99f97c6e13999ec2fc2.zip
CMake-c7ece269daaaa2275c29c99f97c6e13999ec2fc2.tar.gz
CMake-c7ece269daaaa2275c29c99f97c6e13999ec2fc2.tar.bz2
FindCUDAToolkit: Handle toolkits that don't provide nvptxcompiler
Some versions of the CUDA toolkit don't provide any static libraries, and therefore we need to handle that `nvptxcompiler_static` might not be found
-rw-r--r--Modules/FindCUDAToolkit.cmake4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake
index 94c86e9..f06f0e8 100644
--- a/Modules/FindCUDAToolkit.cmake
+++ b/Modules/FindCUDAToolkit.cmake
@@ -1060,7 +1060,9 @@ if(CUDAToolkit_FOUND)
if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 11.1.0)
if(NOT TARGET CUDA::nvptxcompiler_static)
_CUDAToolkit_find_and_add_import_lib(nvptxcompiler_static DEPS cuda_driver)
- target_link_libraries(CUDA::nvptxcompiler_static INTERFACE Threads::Threads)
+ if(TARGET CUDA::nvptxcompiler_static)
+ target_link_libraries(CUDA::nvptxcompiler_static INTERFACE Threads::Threads)
+ endif()
endif()
endif()