Browse Source

CUDA: Error if can't determine toolkit library root

Finding the toolkit is required for Clang and is assumed to have been correctly
found by FindCUDAToolkit if the CUDA language is found.
Error out early with an useful error instead of failing later on due to the
path not being set.
Raul Tambre 5 years ago
parent
commit
046e454fdd
1 changed files with 2 additions and 0 deletions
  1. 2 0
      Modules/CMakeDetermineCUDACompiler.cmake

+ 2 - 0
Modules/CMakeDetermineCUDACompiler.cmake

@@ -183,6 +183,8 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN)
       set(CMAKE_CUDA_COMPILER_LIBRARY_ROOT "${CMAKE_SYSROOT_LINK}/usr/lib/cuda")
     elseif(EXISTS "${CMAKE_SYSROOT}/usr/lib/cuda/nvvm/libdevice")
       set(CMAKE_CUDA_COMPILER_LIBRARY_ROOT "${CMAKE_SYSROOT}/usr/lib/cuda")
+    else()
+      message(FATAL_ERROR "Couldn't find CUDA library root.")
     endif()
 
     # CMAKE_CUDA_COMPILER_TOOLKIT_LIBRARY_ROOT contains the linking stubs necessary for device linking and other low-level library files.