diff options
author | Raul Tambre <raul@tambre.ee> | 2020-06-11 16:50:04 (GMT) |
---|---|---|
committer | Raul Tambre <raul@tambre.ee> | 2020-06-12 18:49:15 (GMT) |
commit | 8c144fe9adf213bb91474e97b569e55f163dabd1 (patch) | |
tree | ffee8441f44384d19102cf42187d3536cecac0b5 /Modules/CMakeDetermineCUDACompiler.cmake | |
parent | 403f8d31e3fed4067b810c683391fc1fdffe815a (diff) | |
download | CMake-8c144fe9adf213bb91474e97b569e55f163dabd1.zip CMake-8c144fe9adf213bb91474e97b569e55f163dabd1.tar.gz CMake-8c144fe9adf213bb91474e97b569e55f163dabd1.tar.bz2 |
FindCUDAToolkit: Compute CUDAToolkit_INCLUDE_DIR instead of searching
We can avoid searching for this since CUDAToolkit_TARGET_DIR always contains
the include/ directory. But add a warning just in case.
Also apply this in CMakeDetermineCUDACompiler for Clang code.
Diffstat (limited to 'Modules/CMakeDetermineCUDACompiler.cmake')
-rw-r--r-- | Modules/CMakeDetermineCUDACompiler.cmake | 11 |
1 files changed, 7 insertions, 4 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. |