CUDA: Select CMAKE_CUDA_HOST_COMPILER default from CUDA bin directory
On my system, I have installed GCC 7 (at /usr/bin/{gcc,g++}
) and GCC 6 (at /usr/bin/{gcc,g++}-6
).
CUDA does not support GCC 7 so I've instructed it to use GCC 6 by setting up a symlink at $CUDA_ROOT/bin/{gcc,g++}
which points to /usr/bin/{gcc,g++}-6
.
This is enough to make nvcc work properly and this also worked with my pre-CMake3.8 find_package(CUDA)
setup.
The new first-class CUDA support however seems to ignore these symlinks and uses the wrong host compiler.
Now I can still compile the project by setting using the -DCMAKE_CUDA_HOST_COMPILER=/usr/bin/g++-6
flag, but isn't it possible to find this out automatically by looking at the symlink?