summaryrefslogtreecommitdiffstats
path: root/Modules/FindCUDAToolkit.cmake
diff options
context:
space:
mode:
authorRobert Maynard <rmaynard@nvidia.com>2021-05-06 15:23:50 (GMT)
committerBrad King <brad.king@kitware.com>2021-05-06 16:08:24 (GMT)
commit5e931c5a97380cea3989084007aed3e797fc4438 (patch)
tree416ddfb8d867d9593c264cd2145a7534d7d942ec /Modules/FindCUDAToolkit.cmake
parent1ad4501ae97fb6c6deab096ff0ac7e03d554e26d (diff)
downloadCMake-5e931c5a97380cea3989084007aed3e797fc4438.zip
CMake-5e931c5a97380cea3989084007aed3e797fc4438.tar.gz
CMake-5e931c5a97380cea3989084007aed3e797fc4438.tar.bz2
CUDA: improve regex for CUDA Toolkit root from nvcc verbose output
The original regular expression was greedy and would match any environment variable ending with `TOP` (like `DESKTOP`). This is an issue on windows where `nvcc -v` would output all environment variables before the compiler's verbose output. To resolve this issue we use a tighter match algorithm that looks for `#$ TOP=` instead of `TOP=`. Fixes: #22158
Diffstat (limited to 'Modules/FindCUDAToolkit.cmake')
-rw-r--r--Modules/FindCUDAToolkit.cmake2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake
index de2b068..8801cb1 100644
--- a/Modules/FindCUDAToolkit.cmake
+++ b/Modules/FindCUDAToolkit.cmake
@@ -524,7 +524,7 @@ else()
# NVIDIA HPC SDK, and distro's splayed layouts
execute_process(COMMAND ${CUDAToolkit_NVCC_EXECUTABLE} "-v" "__cmake_determine_cuda"
OUTPUT_VARIABLE _CUDA_NVCC_OUT ERROR_VARIABLE _CUDA_NVCC_OUT)
- if(_CUDA_NVCC_OUT MATCHES "TOP=([^\r\n]*)")
+ if(_CUDA_NVCC_OUT MATCHES "\\#\\$ TOP=([^\r\n]*)")
get_filename_component(CUDAToolkit_BIN_DIR "${CMAKE_MATCH_1}/bin" ABSOLUTE)
else()
get_filename_component(CUDAToolkit_BIN_DIR "${CUDAToolkit_NVCC_EXECUTABLE}" DIRECTORY)