summaryrefslogtreecommitdiffstats
path: root/Modules/FindCUDAToolkit.cmake
diff options
context:
space:
mode:
authorRobert Maynard <rmaynard@nvidia.com>2021-02-08 16:37:02 (GMT)
committerBrad King <brad.king@kitware.com>2021-02-09 14:39:20 (GMT)
commitcd89d1c328439709eb090e099774bbb6ddf8eb95 (patch)
treeab54414e545d79be1757a3217a903b9297c0a0ae /Modules/FindCUDAToolkit.cmake
parentb06a480b5726a44cefb98cf84f0d874c37d1a95c (diff)
downloadCMake-cd89d1c328439709eb090e099774bbb6ddf8eb95.zip
CMake-cd89d1c328439709eb090e099774bbb6ddf8eb95.tar.gz
CMake-cd89d1c328439709eb090e099774bbb6ddf8eb95.tar.bz2
FindCUDAToolkit: Robust version checks when CUDA lang is not enabled
Previously if you set `CMAKE_CUDA_COMPILER` but hadn't enabled the CUDA language, FindCUDAToolkit would not correctly compute the version information.
Diffstat (limited to 'Modules/FindCUDAToolkit.cmake')
-rw-r--r--Modules/FindCUDAToolkit.cmake1
1 files changed, 1 insertions, 0 deletions
diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake
index ac2516c..29275d0 100644
--- a/Modules/FindCUDAToolkit.cmake
+++ b/Modules/FindCUDAToolkit.cmake
@@ -738,6 +738,7 @@ elseif(NOT CUDAToolkit_FIND_QUIETLY)
endif()
if(CUDAToolkit_NVCC_EXECUTABLE AND
+ CMAKE_CUDA_COMPILER_VERSION AND
CUDAToolkit_NVCC_EXECUTABLE STREQUAL CMAKE_CUDA_COMPILER)
# Need to set these based off the already computed CMAKE_CUDA_COMPILER_VERSION value
# This if statement will always match, but is used to provide variables for MATCH 1,2,3...