Browse Source

Merge topic 'FindCUDAToolkit_handle_nvptxcompiler_static_not_existing'

c7ece269da FindCUDAToolkit: Handle toolkits that don't provide nvptxcompiler

Acked-by: Kitware Robot <[email protected]>
Merge-request: !7932
Brad King 3 years ago
parent
commit
66b64b5984
1 changed files with 3 additions and 1 deletions
  1. 3 1
      Modules/FindCUDAToolkit.cmake

+ 3 - 1
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()