diff options
author | Robert Maynard <rmaynard@nvidia.com> | 2023-09-26 16:16:14 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-09-27 17:28:52 (GMT) |
commit | 4316d4dcfd00bd261f7902de68013522bdb9933b (patch) | |
tree | 8bf21d8b444ffd7c4b1b7f2c105814eb3b31b1a4 /Tests | |
parent | 5a79ea2799e27dc78d71ad71cbf7009416e98076 (diff) | |
download | CMake-4316d4dcfd00bd261f7902de68013522bdb9933b.zip CMake-4316d4dcfd00bd261f7902de68013522bdb9933b.tar.gz CMake-4316d4dcfd00bd261f7902de68013522bdb9933b.tar.bz2 |
FindCUDAToolkit: Search all of `nvcc` implicit includes and library dirs
Improves the handling of CUDA layouts where we have multiple include
and library directories listed in the output of `nvcc -v`. This
updates both when the CUDA language is enabled or not.
Fixes: #24915
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/Cuda/Toolkit/CMakeLists.txt | 8 | ||||
-rw-r--r-- | Tests/CudaOnly/Toolkit/CMakeLists.txt | 16 |
2 files changed, 20 insertions, 4 deletions
diff --git a/Tests/Cuda/Toolkit/CMakeLists.txt b/Tests/Cuda/Toolkit/CMakeLists.txt index 8432b71..c2989f0 100644 --- a/Tests/Cuda/Toolkit/CMakeLists.txt +++ b/Tests/Cuda/Toolkit/CMakeLists.txt @@ -26,9 +26,11 @@ set(should_exist CUDAToolkit_LIBRARY_ROOT ) foreach (cuda_loc_var IN LISTS should_exist) - if(NOT EXISTS "${${cuda_loc_var}}") - message(FATAL_ERROR "${cuda_loc_var} variable is expected to be set to valid path") - endif() + foreach (entry IN LISTS ${cuda_loc_var}) + if(NOT EXISTS "${entry}") + message(FATAL_ERROR "${cuda_loc_var} variable is expected to be set to valid path") + endif() + endforeach() endforeach() diff --git a/Tests/CudaOnly/Toolkit/CMakeLists.txt b/Tests/CudaOnly/Toolkit/CMakeLists.txt index e0801a3..506fc9f 100644 --- a/Tests/CudaOnly/Toolkit/CMakeLists.txt +++ b/Tests/CudaOnly/Toolkit/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.15) -project(CudaOnlyToolkit CUDA) +project(CudaOnlyToolkit LANGUAGES CUDA) find_package(CUDAToolkit REQUIRED) if(NOT DEFINED CUDAToolkit_VERSION) @@ -13,8 +13,22 @@ message(STATUS "CUDAToolkit_VERSION_PATCH: ${CUDAToolkit_VERSION_PATCH}") message(STATUS "CUDAToolkit_BIN_DIR: ${CUDAToolkit_BIN_DIR}") message(STATUS "CUDAToolkit_INCLUDE_DIRS: ${CUDAToolkit_INCLUDE_DIRS}") message(STATUS "CUDAToolkit_LIBRARY_DIR: ${CUDAToolkit_LIBRARY_DIR}") +message(STATUS "CUDAToolkit_LIBRARY_ROOT: ${CUDAToolkit_LIBRARY_ROOT}") message(STATUS "CUDAToolkit_NVCC_EXECUTABLE ${CUDAToolkit_NVCC_EXECUTABLE}") +set(should_exist + CUDAToolkit_BIN_DIR + CUDAToolkit_INCLUDE_DIRS + CUDAToolkit_LIBRARY_DIR + CUDAToolkit_LIBRARY_ROOT + ) +foreach (cuda_loc_var IN LISTS should_exist) + foreach (entry IN LISTS ${cuda_loc_var}) + if(NOT EXISTS "${entry}") + message(FATAL_ERROR "${cuda_loc_var}[${entry}] variable is expected to be set to valid path") + endif() + endforeach() +endforeach() set(cuda_libs cudart cuda_driver cublas cufft cufftw curand cusolver cusparse) if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 10.1) |