CUDA: Implement nvcc implicit link line extraction more robustly
Do not assume that the implicit link line is the last line of the output from nvcc -v
. Instead first find the LIBRARIES=
line, and then look for that content on a later line. It appears twice. First on a call to nvlink
, which we ignore. Later it appears on the implicit link line. Extract the latter line. On failure, abort with a FATAL_ERROR
so that the user does not try to build without proper link information.
Once we have the line, parse it with separate_arguments
using the UNIX_COMMAND
option just like CMakeParseImplicitLinkInfo
already does. This robustly parses the command line and removes quoting. Then extract the first argument as the host link launcher.