summaryrefslogtreecommitdiffstats
path: root/Modules/FindCUDA
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-08-01 17:39:55 (GMT)
committerBrad King <brad.king@kitware.com>2018-08-01 17:42:13 (GMT)
commit37ba34c0b0270a09ca935d271f1742aea219070f (patch)
treebfc748d6357c8114725d97cdd86e56e1eb3be1d4 /Modules/FindCUDA
parentf84c15ef2fa30dd074fcccafccec6b9b69266619 (diff)
downloadCMake-37ba34c0b0270a09ca935d271f1742aea219070f.zip
CMake-37ba34c0b0270a09ca935d271f1742aea219070f.tar.gz
CMake-37ba34c0b0270a09ca935d271f1742aea219070f.tar.bz2
FindCUDA/select_compute_arch: Restore two-component CUDA_VERSION
Since commit v3.12.0-rc1~332^2 (FindCUDA/select_compute_arch: Add support for CUDA as a language, 2018-03-15) this module sets `CUDA_VERSION` based on `CMAKE_CUDA_COMPILER_VERSION` when the language is enabled. Limit it to two components for consistency with the normal `FindCUDA` documentation and behavior. Fixes: #18231
Diffstat (limited to 'Modules/FindCUDA')
-rw-r--r--Modules/FindCUDA/select_compute_arch.cmake5
1 files changed, 3 insertions, 2 deletions
diff --git a/Modules/FindCUDA/select_compute_arch.cmake b/Modules/FindCUDA/select_compute_arch.cmake
index 22c04df..cf4fc39 100644
--- a/Modules/FindCUDA/select_compute_arch.cmake
+++ b/Modules/FindCUDA/select_compute_arch.cmake
@@ -18,8 +18,9 @@
#
if(CMAKE_CUDA_COMPILER_LOADED) # CUDA as a language
- if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
- set(CUDA_VERSION "${CMAKE_CUDA_COMPILER_VERSION}")
+ if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA"
+ AND CMAKE_CUDA_COMPILER_VERSION MATCHES "^([0-9]+\\.[0-9]+)")
+ set(CUDA_VERSION "${CMAKE_MATCH_1}")
endif()
endif()