summaryrefslogtreecommitdiffstats
path: root/Tests/Cuda/StaticRuntimePlusToolkit/CMakeLists.txt
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-01-15 18:39:58 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-01-15 18:40:07 (GMT)
commit9f1ce93d92ec33e879ef593de021d0b577de6c68 (patch)
tree8ffaad9b08ce4ac009d89a4bf0bddbaa3f89a49a /Tests/Cuda/StaticRuntimePlusToolkit/CMakeLists.txt
parent6c23cbca371bb37a6de34b2e0d6fc795632da08b (diff)
parent6e474364d19566d211aefed003840be15cba940e (diff)
downloadCMake-9f1ce93d92ec33e879ef593de021d0b577de6c68.zip
CMake-9f1ce93d92ec33e879ef593de021d0b577de6c68.tar.gz
CMake-9f1ce93d92ec33e879ef593de021d0b577de6c68.tar.bz2
Merge topic 'add_cuda_toolkit_tests'
6e474364d1 CUDAToolkit: No targets now depend on the CUDA runtime 907bb7df57 CUDAToolkit: Gracefully handle missing SDK components e500eb80cd CUDAToolkit: add_cuda_link_dependency correctly sets dependencies Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4183
Diffstat (limited to 'Tests/Cuda/StaticRuntimePlusToolkit/CMakeLists.txt')
-rw-r--r--Tests/Cuda/StaticRuntimePlusToolkit/CMakeLists.txt29
1 files changed, 29 insertions, 0 deletions
diff --git a/Tests/Cuda/StaticRuntimePlusToolkit/CMakeLists.txt b/Tests/Cuda/StaticRuntimePlusToolkit/CMakeLists.txt
new file mode 100644
index 0000000..df6c392
--- /dev/null
+++ b/Tests/Cuda/StaticRuntimePlusToolkit/CMakeLists.txt
@@ -0,0 +1,29 @@
+cmake_minimum_required(VERSION 3.15)
+project(StaticRuntimePlusToolkit CXX)
+
+#Goal for this example:
+# Validate that with c++ we can use some components of the CUDA toolkit, and
+# specify the cuda runtime
+find_package(CUDAToolkit REQUIRED)
+
+add_library(Common OBJECT curand.cpp nppif.cpp)
+target_link_libraries(Common PRIVATE CUDA::toolkit)
+set_target_properties(Common PROPERTIES POSITION_INDEPENDENT_CODE ON)
+
+#static runtime with shared toolkit libraries
+add_library(SharedToolkit SHARED shared.cpp)
+target_link_libraries(SharedToolkit PRIVATE Common PUBLIC CUDA::curand CUDA::nppif)
+target_link_libraries(SharedToolkit PUBLIC CUDA::cudart_static)
+
+#static runtime with static toolkit libraries
+add_library(StaticToolkit SHARED static.cpp)
+target_link_libraries(StaticToolkit PRIVATE Common CUDA::curand_static CUDA::nppif_static)
+target_link_libraries(StaticToolkit PUBLIC CUDA::cudart_static)
+
+#static runtime with mixed toolkit libraries
+add_library(MixedToolkit SHARED mixed.cpp)
+target_link_libraries(MixedToolkit PRIVATE Common CUDA::curand CUDA::nppif_static)
+target_link_libraries(MixedToolkit PUBLIC CUDA::cudart_static)
+
+add_executable(StaticRuntimePlusToolkit main.cpp)
+target_link_libraries(StaticRuntimePlusToolkit PRIVATE SharedToolkit StaticToolkit MixedToolkit)