From 37ba34c0b0270a09ca935d271f1742aea219070f Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 1 Aug 2018 13:39:55 -0400 Subject: 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 --- Modules/FindCUDA/select_compute_arch.cmake | 5 +++-- 1 file 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() -- cgit v0.12