mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-29 02:19:18 -05:00
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
This commit is contained in:
committed by
Brad King
parent
5a79ea2799
commit
4316d4dcfd
@@ -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()
|
||||
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user