summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-07-01 12:36:28 (GMT)
committerBrad King <brad.king@kitware.com>2019-07-01 12:36:28 (GMT)
commit7a3d9b08b9f481a9bdf682051b118523a2da922d (patch)
tree600643d136a7aa14f9cb3b4af142e3e09add8b65 /Tests
parent3936e78bfe99329c69d833d2bee286a5c93d35a9 (diff)
parenta4d502a5bfc38254ccb49615be8d7070fca6819e (diff)
downloadCMake-7a3d9b08b9f481a9bdf682051b118523a2da922d.zip
CMake-7a3d9b08b9f481a9bdf682051b118523a2da922d.tar.gz
CMake-7a3d9b08b9f481a9bdf682051b118523a2da922d.tar.bz2
Merge branch 'cuda-no-device-link-when-disabled' into release-3.15
Merge-request: !3491
Diffstat (limited to 'Tests')
-rw-r--r--Tests/Cuda/CMakeLists.txt1
-rw-r--r--Tests/Cuda/NotEnabled/CMakeLists.txt14
-rw-r--r--Tests/Cuda/NotEnabled/lib.cxx5
-rw-r--r--Tests/Cuda/NotEnabled/main.cxx9
4 files changed, 29 insertions, 0 deletions
diff --git a/Tests/Cuda/CMakeLists.txt b/Tests/Cuda/CMakeLists.txt
index 1b3daa6..a30071f 100644
--- a/Tests/Cuda/CMakeLists.txt
+++ b/Tests/Cuda/CMakeLists.txt
@@ -3,6 +3,7 @@ ADD_TEST_MACRO(Cuda.Complex CudaComplex)
ADD_TEST_MACRO(Cuda.ConsumeCompileFeatures CudaConsumeCompileFeatures)
ADD_TEST_MACRO(Cuda.ObjectLibrary CudaObjectLibrary)
ADD_TEST_MACRO(Cuda.MixedStandardLevels MixedStandardLevels)
+ADD_TEST_MACRO(Cuda.NotEnabled CudaNotEnabled)
ADD_TEST_MACRO(Cuda.ToolkitInclude CudaToolkitInclude)
ADD_TEST_MACRO(Cuda.ProperDeviceLibraries ProperDeviceLibraries)
ADD_TEST_MACRO(Cuda.ProperLinkFlags ProperLinkFlags)
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)
diff --git a/Tests/Cuda/NotEnabled/lib.cxx b/Tests/Cuda/NotEnabled/lib.cxx
new file mode 100644
index 0000000..5dae5a3
--- /dev/null
+++ b/Tests/Cuda/NotEnabled/lib.cxx
@@ -0,0 +1,5 @@
+
+int cxx_function(int input)
+{
+ return input;
+}
diff --git a/Tests/Cuda/NotEnabled/main.cxx b/Tests/Cuda/NotEnabled/main.cxx
new file mode 100644
index 0000000..a644207
--- /dev/null
+++ b/Tests/Cuda/NotEnabled/main.cxx
@@ -0,0 +1,9 @@
+
+#include <type_traits>
+
+int main(int argc, char** argv)
+{
+ // make sure we have c++11 enabled
+ using returnv = std::integral_constant<int, 0>;
+ return returnv::value;
+}