summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2020-04-09 13:42:22 (GMT)
committerRobert Maynard <robert.maynard@kitware.com>2020-04-14 13:39:46 (GMT)
commit4f1e24efa05b4a2482e00115608e0f8db28997a7 (patch)
tree9006141f79bb554c241da0af79abe5262babe991 /Modules
parente3185e3d1b92a95c18f22f70b3cef6944dd019eb (diff)
downloadCMake-4f1e24efa05b4a2482e00115608e0f8db28997a7.zip
CMake-4f1e24efa05b4a2482e00115608e0f8db28997a7.tar.gz
CMake-4f1e24efa05b4a2482e00115608e0f8db28997a7.tar.bz2
FindCUDAToolkit searches stub location last
Fixes #20252
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FindCUDAToolkit.cmake22
1 files changed, 20 insertions, 2 deletions
diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake
index 4b14ddc..de7e785 100644
--- a/Modules/FindCUDAToolkit.cmake
+++ b/Modules/FindCUDAToolkit.cmake
@@ -711,8 +711,15 @@ find_path(CUDAToolkit_INCLUDE_DIR
# And find the CUDA Runtime Library libcudart
find_library(CUDA_CUDART
NAMES cudart
- PATH_SUFFIXES lib64 lib64/stubs lib/x64
+ PATH_SUFFIXES lib64 lib/x64
)
+if (NOT CUDA_CUDART)
+ find_library(CUDA_CUDART
+ NAMES cudart
+ PATH_SUFFIXES lib64/stubs lib/x64/stubs
+ )
+endif()
+
if (NOT CUDA_CUDART AND NOT CUDAToolkit_FIND_QUIETLY)
message(STATUS "Unable to find cudart library.")
endif()
@@ -759,9 +766,20 @@ if(CUDAToolkit_FOUND)
NAMES ${search_names}
HINTS ${CUDAToolkit_LIBRARY_DIR}
ENV CUDA_PATH
- PATH_SUFFIXES nvidia/current lib64 lib64/stubs lib/x64 lib lib/stubs
+ PATH_SUFFIXES nvidia/current lib64 lib/x64 lib
${arg_EXTRA_PATH_SUFFIXES}
)
+ # Don't try any stub directories intil we have exhausted all other
+ # search locations.
+ if(NOT CUDA_${lib_name}_LIBRARY)
+ find_library(CUDA_${lib_name}_LIBRARY
+ NAMES ${search_names}
+ HINTS ${CUDAToolkit_LIBRARY_DIR}
+ ENV CUDA_PATH
+ PATH_SUFFIXES lib64/stubs lib/x64/stubs lib/stubs stubs
+ )
+ endif()
+
mark_as_advanced(CUDA_${lib_name}_LIBRARY)
if (NOT TARGET CUDA::${lib_name} AND CUDA_${lib_name}_LIBRARY)