summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeDetermineCUDACompiler.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-03-26 14:40:11 (GMT)
committerBrad King <brad.king@kitware.com>2019-03-26 14:43:51 (GMT)
commitb127e0c5610221d10c1d6658db96741ab85a083c (patch)
tree5247f236f80f1661a4b091ffd4d97e3080a678c3 /Modules/CMakeDetermineCUDACompiler.cmake
parentbf02d625325535f485512eba307cff54c08bb257 (diff)
downloadCMake-b127e0c5610221d10c1d6658db96741ab85a083c.zip
CMake-b127e0c5610221d10c1d6658db96741ab85a083c.tar.gz
CMake-b127e0c5610221d10c1d6658db96741ab85a083c.tar.bz2
CUDA: Tolerate square brackets in PROMPT environment variable
The `PROMPT` environment variable affects nvcc's output. Fix our parsing of that output to tolerate square brackets. Fixes: #19089
Diffstat (limited to 'Modules/CMakeDetermineCUDACompiler.cmake')
-rw-r--r--Modules/CMakeDetermineCUDACompiler.cmake5
1 files changed, 5 insertions, 0 deletions
diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake
index 113b520..490d659 100644
--- a/Modules/CMakeDetermineCUDACompiler.cmake
+++ b/Modules/CMakeDetermineCUDACompiler.cmake
@@ -111,10 +111,15 @@ elseif(CMAKE_CUDA_COMPILER_ID STREQUAL NVIDIA)
if(_nvcc_libraries)
# Remove variable assignments.
string(REGEX REPLACE "#\\\$ *[^= ]+=[^\n]*\n" "" _nvcc_output "${_nvcc_output_orig}")
+ # Encode [] characters that break list expansion.
+ string(REPLACE "[" "{==={" _nvcc_output "${_nvcc_output}")
+ string(REPLACE "]" "}===}" _nvcc_output "${_nvcc_output}")
# Split lines.
string(REGEX REPLACE "\n+(#\\\$ )?" ";" _nvcc_output "${_nvcc_output}")
foreach(line IN LISTS _nvcc_output)
set(_nvcc_output_line "${line}")
+ string(REPLACE "{==={" "[" _nvcc_output_line "${_nvcc_output_line}")
+ string(REPLACE "}===}" "]" _nvcc_output_line "${_nvcc_output_line}")
string(APPEND _nvcc_log " considering line: [${_nvcc_output_line}]\n")
if("${_nvcc_output_line}" MATCHES "^ *nvlink")
string(APPEND _nvcc_log " ignoring nvlink line\n")