summaryrefslogtreecommitdiffstats
path: root/Modules/FindCUDA.cmake
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2017-08-10 13:33:06 (GMT)
committerRobert Maynard <robert.maynard@kitware.com>2017-08-10 13:33:06 (GMT)
commitd9c8aa47c2e7a2f97def22847a76c3cfcba74f01 (patch)
tree8e3674b03345c372db2d6154919722be7c6d5a87 /Modules/FindCUDA.cmake
parent2d5e494637f9dad13fd0206ac3420e7d26f8b778 (diff)
downloadCMake-d9c8aa47c2e7a2f97def22847a76c3cfcba74f01.zip
CMake-d9c8aa47c2e7a2f97def22847a76c3cfcba74f01.tar.gz
CMake-d9c8aa47c2e7a2f97def22847a76c3cfcba74f01.tar.bz2
FindCUDA: Always obey the CUDA_USE_STATIC_CUDA_RUNTIME option.
Fixes #17150, where the FindCUDA would incorrectly handle CUDA_USE_STATIC_CUDA_RUNTIME being set to false.
Diffstat (limited to 'Modules/FindCUDA.cmake')
-rw-r--r--Modules/FindCUDA.cmake8
1 files changed, 6 insertions, 2 deletions
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index 5dc55d4..b79f787 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -589,7 +589,6 @@ macro(cuda_unset_include_and_libraries)
unset(CUDA_npps_LIBRARY CACHE)
unset(CUDA_nvcuvenc_LIBRARY CACHE)
unset(CUDA_nvcuvid_LIBRARY CACHE)
- unset(CUDA_USE_STATIC_CUDA_RUNTIME CACHE)
unset(CUDA_GPU_DETECT_OUTPUT CACHE)
endmacro()
@@ -802,12 +801,17 @@ endif()
if(CUDA_cudart_static_LIBRARY)
# If static cudart available, use it by default, but provide a user-visible option to disable it.
option(CUDA_USE_STATIC_CUDA_RUNTIME "Use the static version of the CUDA runtime library if available" ON)
- set(CUDA_CUDART_LIBRARY_VAR CUDA_cudart_static_LIBRARY)
else()
# If not available, silently disable the option.
set(CUDA_USE_STATIC_CUDA_RUNTIME OFF CACHE INTERNAL "")
+endif()
+
+if(CUDA_USE_STATIC_CUDA_RUNTIME)
+ set(CUDA_CUDART_LIBRARY_VAR CUDA_cudart_static_LIBRARY)
+else()
set(CUDA_CUDART_LIBRARY_VAR CUDA_CUDART_LIBRARY)
endif()
+
if(NOT CUDA_VERSION VERSION_LESS "5.0")
cuda_find_library_local_first(CUDA_cudadevrt_LIBRARY cudadevrt "\"cudadevrt\" library")
mark_as_advanced(CUDA_cudadevrt_LIBRARY)