Skip to content

CUDA: Fix default selection of host compiler used to drive linking

Brad King requested to merge brad.king/cmake:cuda-default-link-launcher into master

When no explicit CMAKE_CUDA_HOST_COMPILER is specified by the user then we do not pass -ccbin to nvcc. In this case, nvcc's link line we extract during the compiler identification step may not have the absolute path to the host compiler it uses to drive linking. If it is not absolute, use the PATH= from nvcc's output to search for it since that is the one nvcc would use.

This fixes our internal CMAKE_CUDA_HOST_LINK_LAUNCHER value used to construct link lines when using CUDA as the linker language. It needs to match the host compiler nvcc uses internally during compilation.

Fixes: #17323 (closed)

Merge request reports