diff options
author | Brad King <brad.king@kitware.com> | 2019-11-05 16:22:42 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-11-05 16:23:04 (GMT) |
commit | 153226a1471d38ecf54b807a0d6cfa30c436166a (patch) | |
tree | 2b5590e0aadecdd5725dcb6e2c086fee6544d19a /Modules | |
parent | 20fdf9a92b2c46937353a53949636131d3664fc7 (diff) | |
parent | 2e9feddf68a15e9f8909aedbd8b0f3e916273b94 (diff) | |
download | CMake-153226a1471d38ecf54b807a0d6cfa30c436166a.zip CMake-153226a1471d38ecf54b807a0d6cfa30c436166a.tar.gz CMake-153226a1471d38ecf54b807a0d6cfa30c436166a.tar.bz2 |
Merge topic 'FindCUDA-find-nvcc'
2e9feddf68 FindCUDA: Use find_program instead of find_path when searching for nvcc.
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3990
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindCUDA.cmake | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index b6859aa..85d705c 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -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_NVCC NAMES nvcc nvcc.exe PATHS ENV CUDA_TOOLKIT_ROOT @@ -688,19 +688,22 @@ 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_NVCC NAMES nvcc nvcc.exe PATHS /opt/cuda/bin PATH_SUFFIXES cuda/bin DOC "Toolkit location." ) - if (CUDA_TOOLKIT_ROOT_DIR) + if (CUDA_TOOLKIT_ROOT_DIR_NVCC) + get_filename_component(CUDA_TOOLKIT_ROOT_DIR_NVCC_PAR "${CUDA_TOOLKIT_ROOT_DIR_NVCC}" DIRECTORY) + get_filename_component(CUDA_TOOLKIT_ROOT_DIR "${CUDA_TOOLKIT_ROOT_DIR_NVCC_PAR}" DIRECTORY CACHE) string(REGEX REPLACE "[/\\\\]?bin[64]*[/\\\\]?$" "" CUDA_TOOLKIT_ROOT_DIR ${CUDA_TOOLKIT_ROOT_DIR}) # We need to force this back into the cache. set(CUDA_TOOLKIT_ROOT_DIR ${CUDA_TOOLKIT_ROOT_DIR} CACHE PATH "Toolkit location." FORCE) set(CUDA_TOOLKIT_TARGET_DIR ${CUDA_TOOLKIT_ROOT_DIR}) endif() + unset(CUDA_TOOLKIT_ROOT_DIR_NVCC CACHE) if (NOT EXISTS ${CUDA_TOOLKIT_ROOT_DIR}) if(CUDA_FIND_REQUIRED) |