FindCUDAToolkit fails if ccache symlink is found before real nvcc
A recommended ccache run-mode is using symlinks as redirection for ccache compiler wrapping. An advantage of this approach (as opposed to using the RULE_LAUNCH_COMPILE
CMake property) is that non-CMake dependency source-builds also use ccache.
Recently we've discovered the FindCUDAToolkit
module fails if the ccache symlink is found in the path before the real nvcc
binary.
You can reproduce this behavior with this Dockerfile, and the following commands:
# CMake 3.17.2
$ docker build --force-rm --build-arg CMAKE_VERSION=3.17.2 -t test-cmake-find-cuda-toolkit:3.17.2 .
$ docker run --rm -it test-cmake-find-cuda-toolkit:3.17.2
# CMake 3.18.2
$ docker build --force-rm --build-arg CMAKE_VERSION=3.18.2 -t test-cmake-find-cuda-toolkit:3.18.2 .
$ docker run --rm -it test-cmake-find-cuda-toolkit:3.18.2
Edited by Paul Taylor