Browse Source

CUDA_VERSION variable passed to REGEX needs quotes to work when not defined.

James Bigler 15 năm trước cách đây
mục cha
commit
1d5554201f
1 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 2 2
      Modules/FindCUDA.cmake

+ 2 - 2
Modules/FindCUDA.cmake

@@ -486,8 +486,8 @@ if(CUDA_NVCC_EXECUTABLE AND NOT CUDA_VERSION)
   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})
+  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