summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-11-03 12:15:04 +0000
committerKitware Robot <kwrobot@kitware.com>2022-11-03 08:15:12 -0400
commit32352abbd12a02a31a16eac4e774a934675dff8e (patch)
treedd7493adb9562cece1dc816f0aa77eb70e348cdc /Tests
parent083b3198221885364d451a4dec79d958b6b1646a (diff)
parent62f13ed588da428699d84a7e61b6d33b3563a374 (diff)
downloadcmake-32352abbd12a02a31a16eac4e774a934675dff8e.tar.gz
Merge topic 'correct_nvptxcompiler_not_linking_to_threads' into release-3.25
62f13ed588 FindCUDAToolkit: Restore usage from multiple directories Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !7859
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CudaOnly/CMakeLists.txt1
-rw-r--r--Tests/CudaOnly/ToolkitMultipleDirs/CMakeLists.txt22
-rw-r--r--Tests/CudaOnly/ToolkitMultipleDirs/main.cu8
-rw-r--r--Tests/CudaOnly/ToolkitMultipleDirs/subdir/CMakeLists.txt2
4 files changed, 33 insertions, 0 deletions
diff --git a/Tests/CudaOnly/CMakeLists.txt b/Tests/CudaOnly/CMakeLists.txt
index 091872d3ce..39634ac877 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 0000000000..92551499d4
--- /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 0000000000..0f3ccdcc84
--- /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 0000000000..f1f4b89254
--- /dev/null
+++ b/Tests/CudaOnly/ToolkitMultipleDirs/subdir/CMakeLists.txt
@@ -0,0 +1,2 @@
+
+find_package(CUDAToolkit REQUIRED)