diff options
author | Robert Maynard <rmaynard@nvidia.com> | 2021-05-06 11:23:50 -0400 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-05-06 12:08:24 -0400 |
commit | 5e931c5a97380cea3989084007aed3e797fc4438 (patch) | |
tree | 416ddfb8d867d9593c264cd2145a7534d7d942ec /Modules/CMakeDetermineCUDACompiler.cmake | |
parent | 1ad4501ae97fb6c6deab096ff0ac7e03d554e26d (diff) | |
download | cmake-5e931c5a97380cea3989084007aed3e797fc4438.tar.gz |
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/CMakeDetermineCUDACompiler.cmake')
-rw-r--r-- | Modules/CMakeDetermineCUDACompiler.cmake | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake index 1ba537a3eb..e7de9cc938 100644 --- a/Modules/CMakeDetermineCUDACompiler.cmake +++ b/Modules/CMakeDetermineCUDACompiler.cmake @@ -181,7 +181,7 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN) # itself, allowing us to support numerous different scattered toolkit layouts execute_process(COMMAND ${_CUDA_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(CMAKE_CUDA_COMPILER_TOOLKIT_ROOT "${CMAKE_MATCH_1}" ABSOLUTE) else() get_filename_component(CMAKE_CUDA_COMPILER_TOOLKIT_ROOT "${_CUDA_NVCC_EXECUTABLE}" DIRECTORY) |