Commit b127e0c5 authored by Brad King's avatar Brad King

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
parent bf02d625
......@@ -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")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment