summaryrefslogtreecommitdiffstats
path: root/Tests/Cuda/NotEnabled/CMakeLists.txt
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2019-06-27 20:00:01 (GMT)
committerBrad King <brad.king@kitware.com>2019-07-01 12:29:10 (GMT)
commita4d502a5bfc38254ccb49615be8d7070fca6819e (patch)
treec80293ee702af53d38bc76bb0d53413a35389f62 /Tests/Cuda/NotEnabled/CMakeLists.txt
parent753373579e3dd8cf19f0fc18f4d9bec43a2d82e8 (diff)
downloadCMake-a4d502a5bfc38254ccb49615be8d7070fca6819e.zip
CMake-a4d502a5bfc38254ccb49615be8d7070fca6819e.tar.gz
CMake-a4d502a5bfc38254ccb49615be8d7070fca6819e.tar.bz2
CUDA: Do not device link if CUDA is not an enabled language
Checks added in commit 81b4d10d8f (CUDA: More exhaustive checks to determine when to do device linking, 2019-05-09, v3.15.0-rc1~82^2) assumed that CUDA properties would be set only if CUDA is enabled. We cannot do a device link step if we do not have the CUDA language enabled. This was discovered as some projects unconditionally set CUDA properties such as `CUDA_RESOLVE_DEVICE_SYMBOLS` even when the CUDA language has not been enabled. Fixes: #19432
Diffstat (limited to 'Tests/Cuda/NotEnabled/CMakeLists.txt')
-rw-r--r--Tests/Cuda/NotEnabled/CMakeLists.txt14
1 files changed, 14 insertions, 0 deletions
diff --git a/Tests/Cuda/NotEnabled/CMakeLists.txt b/Tests/Cuda/NotEnabled/CMakeLists.txt
new file mode 100644
index 0000000..968751b
--- /dev/null
+++ b/Tests/Cuda/NotEnabled/CMakeLists.txt
@@ -0,0 +1,14 @@
+cmake_minimum_required(VERSION 3.7)
+project(CudaNotEnabled CXX)
+
+add_library(HasCudaProps lib.cxx)
+
+target_compile_features(HasCudaProps PUBLIC cxx_std_11)
+#Verify that setting this variables in a project that doesn't have CUDA
+#enabled allow for the project to configure and build correctly.
+#Tests the fix for #19432
+set_property(TARGET HasCudaProps PROPERTY CUDA_SEPARABLE_COMPILATION ON)
+set_property(TARGET HasCudaProps PROPERTY CUDA_RESOLVE_DEVICE_SYMBOLS ON)
+
+add_executable(CudaNotEnabled main.cxx)
+target_link_libraries(CudaNotEnabled PRIVATE HasCudaProps)