CUDA and CMAKE_SYSROOT: not picking up libraries from the sysroot
Hi,
We have a cross-compilation toolchain (Linux, aarch64) that uses CUDA. Following the recommended pattern for Linux toolchains, we set the CMAKE_SYSROOT
to point to the targetfs
containing the /include
and /lib
from the target platform.
For C++ code this works fine and it uses the libraries from the targetfs
. However it does not work for CUDA libraries, because CMake is appending -L /usr/local/cuda/targets/aarch64-linux/lib
instead of -L <targetfs>/usr/local/cuda/targets/aarch64-linux/lib
. I.e the CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES
is taken from the host filesystem instead of from the targetfs set by CMAKE_SYSROOT
.
Therefore we need ugly symlinks from targetfs
to /usr/local
to make this work. Is there a flag we can use to tell CMake to use the CUDA libraries that it can find inside the targetfs
specified by CMAKE_SYSROOT
?
Thanks!