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.
This commit is contained in:
Robert Maynard
2017-08-10 09:33:06 -04:00
parent 2d5e494637
commit d9c8aa47c2

View File

@@ -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)