diff options
-rw-r--r-- | Modules/CMakeDetermineCUDACompiler.cmake | 11 | ||||
-rw-r--r-- | Modules/FindCUDAToolkit.cmake | 11 |
2 files changed, 14 insertions, 8 deletions
diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake index 205bf07..f31e2e8 100644 --- a/Modules/CMakeDetermineCUDACompiler.cmake +++ b/Modules/CMakeDetermineCUDACompiler.cmake @@ -332,10 +332,13 @@ elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang") message(FATAL_ERROR "Unable to find _CUDA_LIBRARY_DIR based on _CUDA_TARGET_DIR=${_CUDA_TARGET_DIR}") endif() - find_path(_CUDA_INCLUDE_DIR - NAMES cuda_runtime.h - HINTS "${_CUDA_TARGET_DIR}/include" - ) + # _CUDA_TARGET_DIR always points to the directory containing the include directory. + # On a scattered installation /usr, on a non-scattered something like /usr/local/cuda or /usr/local/cuda-10.2/targets/aarch64-linux. + if(EXISTS "${_CUDA_TARGET_DIR}/include/cuda_runtime.h") + set(_CUDA_INCLUDE_DIR "${_CUDA_TARGET_DIR}/include") + else() + message(FATAL_ERROR "Unable to find cuda_runtime.h in \"${_CUDA_TARGET_DIR}/include\" for _CUDA_INCLUDE_DIR.") + endif() # Clang does not add any CUDA SDK libraries or directories when invoking the host linker. # Add the CUDA toolkit library directory ourselves so that linking works. diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake index 555693b..7ec9cbe 100644 --- a/Modules/FindCUDAToolkit.cmake +++ b/Modules/FindCUDAToolkit.cmake @@ -694,10 +694,13 @@ else() set(_CUDAToolkit_Pop_Prefix True) endif() -# Find the include/ directory -find_path(CUDAToolkit_INCLUDE_DIR - NAMES cuda_runtime.h -) +# CUDAToolkit_TARGET_DIR always points to the directory containing the include directory. +# On a scattered installation /usr, on a non-scattered something like /usr/local/cuda or /usr/local/cuda-10.2/targets/aarch64-linux. +if(EXISTS "${CUDAToolkit_TARGET_DIR}/include/cuda_runtime.h") + set(CUDAToolkit_INCLUDE_DIR "${CUDAToolkit_TARGET_DIR}/include") +elseif(NOT CUDAToolkit_FIND_QUIETLY) + message(STATUS "Unable to find cuda_runtime.h in \"${CUDAToolkit_TARGET_DIR}/include\" for CUDAToolkit_INCLUDE_DIR.") +endif() if(CUDAToolkit_NVCC_EXECUTABLE AND CUDAToolkit_NVCC_EXECUTABLE STREQUAL CMAKE_CUDA_COMPILER) |