FindCUDAToolkit: Remove unnecessary checks around searches
find_*() don't search if the result variable is already set. Remove the if()s around such cases.
This commit is contained in:
parent
8f01fe7bf1
commit
9eebb5b8b2
@ -169,12 +169,10 @@ elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang")
|
||||
)
|
||||
|
||||
# If we didn't find NVCC, then try the default paths.
|
||||
if(NOT _CUDA_NVCC_EXECUTABLE)
|
||||
find_program(_CUDA_NVCC_EXECUTABLE
|
||||
NAMES nvcc nvcc.exe
|
||||
PATH_SUFFIXES bin
|
||||
)
|
||||
endif()
|
||||
find_program(_CUDA_NVCC_EXECUTABLE
|
||||
NAMES nvcc nvcc.exe
|
||||
PATH_SUFFIXES bin
|
||||
)
|
||||
|
||||
# If the user specified CUDAToolkit_ROOT but nvcc could not be found, this is an error.
|
||||
if(NOT _CUDA_NVCC_EXECUTABLE AND (DEFINED CUDAToolkit_ROOT OR DEFINED ENV{CUDAToolkit_ROOT}))
|
||||
|
@ -697,12 +697,10 @@ find_library(CUDA_CUDART
|
||||
NAMES cudart
|
||||
PATH_SUFFIXES lib64 lib/x64
|
||||
)
|
||||
if(NOT CUDA_CUDART)
|
||||
find_library(CUDA_CUDART
|
||||
NAMES cudart
|
||||
PATH_SUFFIXES lib64/stubs lib/x64/stubs
|
||||
)
|
||||
endif()
|
||||
find_library(CUDA_CUDART
|
||||
NAMES cudart
|
||||
PATH_SUFFIXES lib64/stubs lib/x64/stubs
|
||||
)
|
||||
|
||||
if(NOT CUDA_CUDART AND NOT CUDAToolkit_FIND_QUIETLY)
|
||||
message(STATUS "Unable to find cudart library.")
|
||||
@ -753,16 +751,14 @@ if(CUDAToolkit_FOUND)
|
||||
PATH_SUFFIXES nvidia/current lib64 lib/x64 lib
|
||||
${arg_EXTRA_PATH_SUFFIXES}
|
||||
)
|
||||
# Don't try any stub directories intil we have exhausted all other
|
||||
# Don't try any stub directories until 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()
|
||||
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
|
||||
)
|
||||
|
||||
mark_as_advanced(CUDA_${lib_name}_LIBRARY)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user