FindCUDA: Use find_program instead of find_path to find nvcc

Otherwise nvcc is not found if it is in env PATH but a non-standard
location.
This commit is contained in:
Hong Xu
2019-10-31 13:50:24 -07:00
committed by Brad King
parent aeaa590cb2
commit 067ee518f7

View File

@@ -676,7 +676,7 @@ endif()
# Search for the cuda distribution.
if(NOT CUDA_TOOLKIT_ROOT_DIR AND NOT CMAKE_CROSSCOMPILING)
# Search in the CUDA_BIN_PATH first.
find_path(CUDA_TOOLKIT_ROOT_DIR
find_program(CUDA_TOOLKIT_ROOT_DIR
NAMES nvcc nvcc.exe
PATHS
ENV CUDA_TOOLKIT_ROOT
@@ -688,7 +688,7 @@ if(NOT CUDA_TOOLKIT_ROOT_DIR AND NOT CMAKE_CROSSCOMPILING)
)
# Now search default paths
find_path(CUDA_TOOLKIT_ROOT_DIR
find_program(CUDA_TOOLKIT_ROOT_DIR
NAMES nvcc nvcc.exe
PATHS /opt/cuda/bin
PATH_SUFFIXES cuda/bin