summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorRaul Tambre <raul@tambre.ee>2020-06-12 17:39:25 (GMT)
committerRaul Tambre <raul@tambre.ee>2020-06-12 18:49:15 (GMT)
commit9eebb5b8b264cad7240d1af515113ca5f2c4ffad (patch)
treec01a805c2c08c58d06e9f90ca40c3d521af5525f /Modules
parent8f01fe7bf139b019eaff5594b558b17862cfab37 (diff)
downloadCMake-9eebb5b8b264cad7240d1af515113ca5f2c4ffad.zip
CMake-9eebb5b8b264cad7240d1af515113ca5f2c4ffad.tar.gz
CMake-9eebb5b8b264cad7240d1af515113ca5f2c4ffad.tar.bz2
FindCUDAToolkit: Remove unnecessary checks around searches
find_*() don't search if the result variable is already set. Remove the if()s around such cases.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CMakeDetermineCUDACompiler.cmake10
-rw-r--r--Modules/FindCUDAToolkit.cmake26
2 files changed, 15 insertions, 21 deletions
diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake
index 2c1a40e..534b8b5 100644
--- a/Modules/CMakeDetermineCUDACompiler.cmake
+++ b/Modules/CMakeDetermineCUDACompiler.cmake
@@ -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}))
diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake
index 84bcf34..b4661fb 100644
--- a/Modules/FindCUDAToolkit.cmake
+++ b/Modules/FindCUDAToolkit.cmake
@@ -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)