summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-08-19 11:24:51 (GMT)
committerKitware Robot <kwrobot@kitware.com>2022-08-19 11:25:00 (GMT)
commit7b9757e50715ab6abc08e7005c66565f5c965de3 (patch)
tree4404959ee175b0988d65978bdbcc30abe8f66410 /Tests
parentd69d0316da2bd8ead5f9ebd03180e329a6180a1d (diff)
parentea659b155ddcdfb24e93b0d664e1cb67fef6d8a4 (diff)
downloadCMake-7b9757e50715ab6abc08e7005c66565f5c965de3.zip
CMake-7b9757e50715ab6abc08e7005c66565f5c965de3.tar.gz
CMake-7b9757e50715ab6abc08e7005c66565f5c965de3.tar.bz2
Merge topic 'cuda_mark_toolkit_includes_as_system'
ea659b155d CUDA: Always mark cuda toolkit as system include Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !7476
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CudaOnly/CMakeLists.txt6
-rw-r--r--Tests/CudaOnly/ToolkitIsSystemInclude/CMakeLists.txt7
-rw-r--r--Tests/CudaOnly/ToolkitIsSystemInclude/include/nvrtc.h5
-rw-r--r--Tests/CudaOnly/ToolkitIsSystemInclude/main.cu4
4 files changed, 20 insertions, 2 deletions
diff --git a/Tests/CudaOnly/CMakeLists.txt b/Tests/CudaOnly/CMakeLists.txt
index 091872d..d23e929 100644
--- a/Tests/CudaOnly/CMakeLists.txt
+++ b/Tests/CudaOnly/CMakeLists.txt
@@ -27,10 +27,12 @@ if(CMake_TEST_CUDA AND NOT CMake_TEST_CUDA STREQUAL "Clang")
add_cuda_test_macro(CudaOnly.GPUDebugFlag CudaOnlyGPUDebugFlag)
endif()
-# The CUDA only ships the shared version of the toolkit libraries
-# on windows
if(NOT WIN32)
+ # The CUDA only ships the shared version of the toolkit libraries
+ # on windows
add_cuda_test_macro(CudaOnly.StaticRuntimePlusToolkit CudaOnlyStaticRuntimePlusToolkit)
+ # `isystem` behaves differently on windows with nvcc
+ add_cuda_test_macro(CudaOnly.ToolkitIsSystemInclude CudaOnlySystemInclude)
endif()
add_cuda_test_macro(CudaOnly.DeviceLTO CudaOnlyDeviceLTO)
diff --git a/Tests/CudaOnly/ToolkitIsSystemInclude/CMakeLists.txt b/Tests/CudaOnly/ToolkitIsSystemInclude/CMakeLists.txt
new file mode 100644
index 0000000..bc347dd
--- /dev/null
+++ b/Tests/CudaOnly/ToolkitIsSystemInclude/CMakeLists.txt
@@ -0,0 +1,7 @@
+cmake_minimum_required(VERSION 3.24)
+project(ToolkitIsSystemInclude CUDA)
+
+# Verify that the nvrtc.h that is inside `CMAKE_CURRENT_SOURCE_DIR` is still
+# the first include for `.cu` files.
+add_executable(CudaOnlySystemInclude main.cu)
+target_include_directories(CudaOnlySystemInclude SYSTEM PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
diff --git a/Tests/CudaOnly/ToolkitIsSystemInclude/include/nvrtc.h b/Tests/CudaOnly/ToolkitIsSystemInclude/include/nvrtc.h
new file mode 100644
index 0000000..5a015c4
--- /dev/null
+++ b/Tests/CudaOnly/ToolkitIsSystemInclude/include/nvrtc.h
@@ -0,0 +1,5 @@
+#define CMAKE_CUDA_TOOLKIT_IS_SYSTEM 1
+
+int main()
+{
+}
diff --git a/Tests/CudaOnly/ToolkitIsSystemInclude/main.cu b/Tests/CudaOnly/ToolkitIsSystemInclude/main.cu
new file mode 100644
index 0000000..6cff8a1
--- /dev/null
+++ b/Tests/CudaOnly/ToolkitIsSystemInclude/main.cu
@@ -0,0 +1,4 @@
+#include "nvrtc.h"
+#ifndef CMAKE_CUDA_TOOLKIT_IS_SYSTEM
+# error "Failed to specify the CUDA Toolkit includes as system"
+#endif