summaryrefslogtreecommitdiffstats
path: root/Modules/FindCUDA.cmake
diff options
context:
space:
mode:
authorJames Bigler <jamesbigler@gmail.com>2010-05-12 22:38:51 (GMT)
committerJames Bigler <jamesbigler@gmail.com>2010-05-12 22:38:51 (GMT)
commit0d30e3fe91717f519722a71470a5180c13818a2a (patch)
tree032c827a908dc3fd83fd7438c564df348e826414 /Modules/FindCUDA.cmake
parent08b56ae3be5635cd84defe331e1bfef86df63067 (diff)
downloadCMake-0d30e3fe91717f519722a71470a5180c13818a2a.zip
CMake-0d30e3fe91717f519722a71470a5180c13818a2a.tar.gz
CMake-0d30e3fe91717f519722a71470a5180c13818a2a.tar.bz2
Fixed: CUDA_VERSION_MAJOR/MINOR now computed after first run.
CUDA_VERSION_MAJOR and CUDA_VERSION_MINOR were only computed when CUDA_VERSION was first computed. Subsequent runs of FindCUDA would not have CUDA_VERSION_MAJOR/MINOR set. We now extract the major and minor versions from the CUDA_VERSION cache variable every run.
Diffstat (limited to 'Modules/FindCUDA.cmake')
-rw-r--r--Modules/FindCUDA.cmake4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index 6539057..2c2e9fd 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -484,6 +484,10 @@ if(CUDA_NVCC_EXECUTABLE AND NOT CUDA_VERSION)
string(REGEX REPLACE ".*release ([0-9]+)\\.([0-9]+).*" "\\2" CUDA_VERSION_MINOR ${NVCC_OUT})
set(CUDA_VERSION "${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR}" CACHE STRING "Version of CUDA as computed from nvcc.")
mark_as_advanced(CUDA_VERSION)
+else()
+ # Need to set these based off of the cached value
+ string(REGEX REPLACE "([0-9]+)\\.([0-9]+).*" "\\1" CUDA_VERSION_MAJOR ${CUDA_VERSION})
+ string(REGEX REPLACE "([0-9]+)\\.([0-9]+).*" "\\2" CUDA_VERSION_MINOR ${CUDA_VERSION})
endif()
# Always set this convenience variable