summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-12-06 20:27:14 (GMT)
committerBrad King <brad.king@kitware.com>2023-12-06 21:10:24 (GMT)
commitd85bf99bcb52577e065458fdb4486eff7c67456b (patch)
tree9e5034b63ea0858d4ea886d815d650a857517481
parent618fdc1c42e127e5807c4b863dd7823a8093c15e (diff)
downloadCMake-d85bf99bcb52577e065458fdb4486eff7c67456b.zip
CMake-d85bf99bcb52577e065458fdb4486eff7c67456b.tar.gz
CMake-d85bf99bcb52577e065458fdb4486eff7c67456b.tar.bz2
FindCUDAToolkit: Fix stub library representation on reconfigure
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.
-rw-r--r--Modules/FindCUDAToolkit.cmake12
1 files changed, 7 insertions, 5 deletions
diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake
index 0a22e63..f1b9684 100644
--- a/Modules/FindCUDAToolkit.cmake
+++ b/Modules/FindCUDAToolkit.cmake
@@ -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)