Merge topic 'FindCUDAToolkit-fix-stubs' into release-3.28

d85bf99bcb FindCUDAToolkit: Fix stub library representation on reconfigure

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robertjmaynard@gmail.com>
Merge-request: !9045
This commit is contained in:
Brad King
2023-12-07 15:57:13 +00:00
committed by Kitware Robot

View File

@@ -1096,11 +1096,13 @@ if(CUDAToolkit_FOUND)
ENV CUDA_PATH
PATH_SUFFIXES lib64/stubs lib/x64/stubs lib/stubs stubs
)
if(CUDA_${lib_name}_LIBRARY AND NOT WIN32)
# Use `IMPORTED_IMPLIB` so that we don't add a `-rpath` entry for stub directories
set(CUDA_IMPORT_PROPERTY IMPORTED_IMPLIB)
set(CUDA_IMPORT_TYPE SHARED)
endif()
endif()
if(CUDA_${lib_name}_LIBRARY MATCHES "/stubs/" AND NOT WIN32)
# Use a SHARED library with IMPORTED_IMPLIB, but not IMPORTED_LOCATION,
# to indicate that the stub is for linkers but not dynamic loaders.
# It will not contribute any RPATH entry.
set(CUDA_IMPORT_PROPERTY IMPORTED_IMPLIB)
set(CUDA_IMPORT_TYPE SHARED)
endif()
mark_as_advanced(CUDA_${lib_name}_LIBRARY)