summaryrefslogtreecommitdiffstats
path: root/Modules/FindCUDAToolkit.cmake
diff options
context:
space:
mode:
authorRaul Tambre <raul@tambre.ee>2020-03-14 17:48:23 (GMT)
committerBrad King <brad.king@kitware.com>2020-04-07 13:33:26 (GMT)
commitd86fcc63591ccc44163b27023d8cc8cf0b9a1363 (patch)
treeb6433609d955bcea7a81c665e273a7aa6ba76d9e /Modules/FindCUDAToolkit.cmake
parent87e98bf8be8e69b13fe15d5211b2366b5012bb17 (diff)
downloadCMake-d86fcc63591ccc44163b27023d8cc8cf0b9a1363.zip
CMake-d86fcc63591ccc44163b27023d8cc8cf0b9a1363.tar.gz
CMake-d86fcc63591ccc44163b27023d8cc8cf0b9a1363.tar.bz2
CUDAToolkit: Deduce toolkit binary directory from compiler path only for NVCC
This assumption doesn't hold for Clang. When crosscompiling this causes X86 libraries to be used and thus linker errors.
Diffstat (limited to 'Modules/FindCUDAToolkit.cmake')
-rw-r--r--Modules/FindCUDAToolkit.cmake4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake
index 4b14ddc..eed1d81 100644
--- a/Modules/FindCUDAToolkit.cmake
+++ b/Modules/FindCUDAToolkit.cmake
@@ -473,9 +473,9 @@ Result variables
#
###############################################################################
-if(CMAKE_CUDA_COMPILER_LOADED AND NOT CUDAToolkit_BIN_DIR)
+# For NVCC we can easily deduce the SDK binary directory from the compiler path.
+if(CMAKE_CUDA_COMPILER_LOADED AND NOT CUDAToolkit_BIN_DIR AND CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
get_filename_component(cuda_dir "${CMAKE_CUDA_COMPILER}" DIRECTORY)
- # use the already detected cuda compiler
set(CUDAToolkit_BIN_DIR "${cuda_dir}" CACHE PATH "")
mark_as_advanced(CUDAToolkit_BIN_DIR)
unset(cuda_dir)