diff options
author | David Berard <davidberard98@gmail.com> | 2022-01-26 18:42:45 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-01-26 19:07:17 (GMT) |
commit | f590ea506affd4b7181ed8672efd4b9ec9fb31a9 (patch) | |
tree | 3b9b1f8536be8fec0b87d68e9013caa953364561 | |
parent | dbfa449f080774fa24eaa5fa2edbee2d32405db3 (diff) | |
download | CMake-f590ea506affd4b7181ed8672efd4b9ec9fb31a9.zip CMake-f590ea506affd4b7181ed8672efd4b9ec9fb31a9.tar.gz CMake-f590ea506affd4b7181ed8672efd4b9ec9fb31a9.tar.bz2 |
FindCUDA: Make version extraction robust to empty output
I found that `NVCC_OUT` was sometimes empty when I was building.
-rw-r--r-- | Modules/FindCUDA.cmake | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index dd795f4..af5f798 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -926,8 +926,8 @@ mark_as_advanced(CUDA_NVCC_EXECUTABLE) if(CUDA_NVCC_EXECUTABLE AND NOT CUDA_VERSION) # Compute the version. execute_process (COMMAND ${CUDA_NVCC_EXECUTABLE} "--version" OUTPUT_VARIABLE NVCC_OUT) - string(REGEX REPLACE ".*release ([0-9]+)\\.([0-9]+).*" "\\1" CUDA_VERSION_MAJOR ${NVCC_OUT}) - string(REGEX REPLACE ".*release ([0-9]+)\\.([0-9]+).*" "\\2" CUDA_VERSION_MINOR ${NVCC_OUT}) + string(REGEX REPLACE ".*release ([0-9]+)\\.([0-9]+).*" "\\1" CUDA_VERSION_MAJOR "${NVCC_OUT}") + 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() |