diff options
author | Robert Maynard <rmaynard@nvidia.com> | 2022-11-02 16:13:41 (GMT) |
---|---|---|
committer | Robert Maynard <rmaynard@nvidia.com> | 2022-11-02 16:23:30 (GMT) |
commit | 62f13ed588da428699d84a7e61b6d33b3563a374 (patch) | |
tree | d372ab05ef3dc47cb0871f1fc8ecd9ea3590f1c6 /Tests | |
parent | 301815eb6243c7598c246d06524cff51f7e90576 (diff) | |
download | CMake-62f13ed588da428699d84a7e61b6d33b3563a374.zip CMake-62f13ed588da428699d84a7e61b6d33b3563a374.tar.gz CMake-62f13ed588da428699d84a7e61b6d33b3563a374.tar.bz2 |
FindCUDAToolkit: Restore usage from multiple directories
Fixes #24119
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CudaOnly/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Tests/CudaOnly/ToolkitMultipleDirs/CMakeLists.txt | 22 | ||||
-rw-r--r-- | Tests/CudaOnly/ToolkitMultipleDirs/main.cu | 8 | ||||
-rw-r--r-- | Tests/CudaOnly/ToolkitMultipleDirs/subdir/CMakeLists.txt | 2 |
4 files changed, 33 insertions, 0 deletions
diff --git a/Tests/CudaOnly/CMakeLists.txt b/Tests/CudaOnly/CMakeLists.txt index 091872d..39634ac 100644 --- a/Tests/CudaOnly/CMakeLists.txt +++ b/Tests/CudaOnly/CMakeLists.txt @@ -13,6 +13,7 @@ add_cuda_test_macro(CudaOnly.SharedRuntimePlusToolkit CudaOnlySharedRuntimePlusT add_cuda_test_macro(CudaOnly.Standard98 CudaOnlyStandard98) add_cuda_test_macro(CudaOnly.Toolkit CudaOnlyToolkit) add_cuda_test_macro(CudaOnly.ToolkitBeforeLang CudaOnlyToolkitBeforeLang) +add_cuda_test_macro(CudaOnly.ToolkitMultipleDirs CudaOnlyToolkitMultipleDirs) add_cuda_test_macro(CudaOnly.WithDefs CudaOnlyWithDefs) add_cuda_test_macro(CudaOnly.CircularLinkLine CudaOnlyCircularLinkLine) add_cuda_test_macro(CudaOnly.ResolveDeviceSymbols CudaOnlyResolveDeviceSymbols) diff --git a/Tests/CudaOnly/ToolkitMultipleDirs/CMakeLists.txt b/Tests/CudaOnly/ToolkitMultipleDirs/CMakeLists.txt new file mode 100644 index 0000000..9255149 --- /dev/null +++ b/Tests/CudaOnly/ToolkitMultipleDirs/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 3.15) +project(CudaOnlyToolkitMultipleDirs CUDA) + +find_package(CUDAToolkit REQUIRED) + +add_subdirectory(subdir) + +if(NOT DEFINED CUDAToolkit_VERSION) + message(FATAL_ERROR "expected CUDAToolkit variable CUDAToolkit_VERSION not found") +endif() + +message(STATUS "CUDAToolkit_VERSION: ${CUDAToolkit_VERSION}") +message(STATUS "CUDAToolkit_VERSION_MAJOR: ${CUDAToolkit_VERSION_MAJOR}") +message(STATUS "CUDAToolkit_VERSION_MINOR: ${CUDAToolkit_VERSION_MINOR}") +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_NVCC_EXECUTABLE ${CUDAToolkit_NVCC_EXECUTABLE}") + +add_executable(CudaOnlyToolkitMultipleDirs main.cu) +target_link_libraries(CudaOnlyToolkitMultipleDirs PRIVATE CUDA::toolkit) diff --git a/Tests/CudaOnly/ToolkitMultipleDirs/main.cu b/Tests/CudaOnly/ToolkitMultipleDirs/main.cu new file mode 100644 index 0000000..0f3ccdc --- /dev/null +++ b/Tests/CudaOnly/ToolkitMultipleDirs/main.cu @@ -0,0 +1,8 @@ +// Only thing we care about is that these headers are found +#include <cuda.h> +#include <cuda_runtime_api.h> + +int main(int argc, char** argv) +{ + return 0; +} diff --git a/Tests/CudaOnly/ToolkitMultipleDirs/subdir/CMakeLists.txt b/Tests/CudaOnly/ToolkitMultipleDirs/subdir/CMakeLists.txt new file mode 100644 index 0000000..f1f4b89 --- /dev/null +++ b/Tests/CudaOnly/ToolkitMultipleDirs/subdir/CMakeLists.txt @@ -0,0 +1,2 @@ + +find_package(CUDAToolkit REQUIRED) |