The nvrtc-builtins and nvptxcompiler projects don't required linking
to the cuda driver. We previously did this due to reading the
upstream documentation incorrectly.
We represent stub libraries, e.g., for CUDA, using imported `SHARED`
library targets with only `IMPORTED_IMPLIB`, and no `IMPORTED_LOCATION`,
to indicate that the stub file is meant only for linkers and not dynamic
loaders. See commit 7351d590ee (cmTarget: Add a way to represent
imported shared library stubs, 2023-07-17, v3.28.0-rc1~344^2) and commit
fc6508921c (cmComputeLinkInformation: Restore soname lookup for
non-imported targets, 2023-12-05, v3.28.0~4^2).
If a shared library is linked to a stub, it has a `NEEDED` field
populated with the `SONAME` found in the stub. When a dependent target
links to such a shared library, some linkers want to find a library file
on disk and load it to see what symbols it provides. This is necessary
for linkers that enforce `--no-allow-shlib-undefined`. On hosts with
only the stub library installed, e.g., with only the CUDA toolkit
development package, the real runtime library corresponding to the
stub's `SONAME` may not even exist, so no `-rpath-link` flag can help
linkers find it. Pass the stub library to linkers explicitly so they
can find it without searching.
Fixes#25484
PR !8835 failed to update the CUPTI header searches to use the
new internal FindCUDAToolkit search variables. This caused the
CUDA::cupti target to always not exist.
Since commit 0744c02e24 (FindCUDAToolkit: targets pointing to stubs now
use IMPORTED_IMPLIB, 2023-07-24, v3.28.0-rc1~309^2) we recognize CUDA
stub libraries and represent them in a special way. However, the logic
only works on the first configuration of a build tree when the libraries
are first found. Once the results are cached, we incorrectly revert to
the non-stub representation.
Fix this by recognizing stub libraries based on their path instead.
Improves the handling of CUDA layouts where we have multiple include
and library directories listed in the output of `nvcc -v`. This
updates both when the CUDA language is enabled or not.
Fixes: #24915
Previously REAL_PATH would collapse paths before resolving any symlinks
so if `..` crossed a symlink the output from `REAL_PATH` would be wrong.
It looked like REAL_PATH did this by mistake since it was a side-effect
of ensuring we had an absolute path before resolving symlinks.
The lib is named `libnvrtc-builtins.so`, not `libnvrtc_builtins.so`.
Update the change from commit 2a94c762ed (FindCUDAToolkit: Add support
for CUDA::nvrtc_static, 2023-01-20, v3.26.0-rc1~55^2). Apply a fix
similar to commit 9688a8ebc2 (FindCUDAToolkit: Fix
`nvrtc_builtins_static` library name, 2023-02-03, v3.26.0-rc2~15^2).
The cuFile API documentation has moved, so link to its new location.
The nvGRAPH library has been removed, so link to a web archive copy.
The NTVX library has a higher-level landing page.
Update the change from commit 2a94c762ed (FindCUDAToolkit: Add support
for CUDA::nvrtc_static, 2023-01-20, v3.26.0-rc1~55^2). The lib is named
`libnvrtc-builtins_static.a`, not `libnvrtc_builtins_static.a`.
989d50d7fc FindCUDAToolkit: Support nvhpc splayed layouts without symlinks
207518b6e8 FindCUDAToolkit: Handle CUDAToolkit_TARGET_DIR dir being a symlink
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7945