summaryrefslogtreecommitdiffstats
path: root/Tests/Cuda
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2017-12-13 16:15:06 (GMT)
committerBrad King <brad.king@kitware.com>2017-12-15 15:29:20 (GMT)
commit4b7618d17028da30bf0421e56aed6789bba4a12a (patch)
treee1cfaa81f14107a8988b4a0132b0d3c362d51326 /Tests/Cuda
parent1d2d9c18bd477a6fab1744d8da13bf5d760a0e03 (diff)
downloadCMake-4b7618d17028da30bf0421e56aed6789bba4a12a.zip
CMake-4b7618d17028da30bf0421e56aed6789bba4a12a.tar.gz
CMake-4b7618d17028da30bf0421e56aed6789bba4a12a.tar.bz2
CUDA: Fix CUDA_STANDARD selection via cxx_std_11 with CXX_STANDARD
When C++ features require a certain C++/CUDA level, verify or update the standard level target property for each language independently. While at it, add missing rejection of invalid `CUDA_STANDARD` property values. Co-Author: Brad King <brad.king@kitware.com> Fixes: #17519
Diffstat (limited to 'Tests/Cuda')
-rw-r--r--Tests/Cuda/CMakeLists.txt1
-rw-r--r--Tests/Cuda/MixedStandardLevels/CMakeLists.txt14
-rw-r--r--Tests/Cuda/MixedStandardLevels/main.cu10
3 files changed, 25 insertions, 0 deletions
diff --git a/Tests/Cuda/CMakeLists.txt b/Tests/Cuda/CMakeLists.txt
index de48501..8a43df5 100644
--- a/Tests/Cuda/CMakeLists.txt
+++ b/Tests/Cuda/CMakeLists.txt
@@ -2,6 +2,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.ToolkitInclude CudaToolkitInclude)
ADD_TEST_MACRO(Cuda.ProperLinkFlags ProperLinkFlags)
ADD_TEST_MACRO(Cuda.WithC CudaWithC)
diff --git a/Tests/Cuda/MixedStandardLevels/CMakeLists.txt b/Tests/Cuda/MixedStandardLevels/CMakeLists.txt
new file mode 100644
index 0000000..683abe7
--- /dev/null
+++ b/Tests/Cuda/MixedStandardLevels/CMakeLists.txt
@@ -0,0 +1,14 @@
+cmake_minimum_required(VERSION 3.7)
+project(CudaComplex CXX CUDA)
+
+string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30")
+
+set(CMAKE_CXX_STANDARD 11)
+
+add_executable(MixedStandardLevels main.cu)
+target_compile_features(MixedStandardLevels PUBLIC cxx_std_11)
+
+if(APPLE)
+ # Help the static cuda runtime find the driver (libcuda.dyllib) at runtime.
+ set_property(TARGET MixedStandardLevels PROPERTY BUILD_RPATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES})
+endif()
diff --git a/Tests/Cuda/MixedStandardLevels/main.cu b/Tests/Cuda/MixedStandardLevels/main.cu
new file mode 100644
index 0000000..d57c05a
--- /dev/null
+++ b/Tests/Cuda/MixedStandardLevels/main.cu
@@ -0,0 +1,10 @@
+
+#include <type_traits>
+
+int main(int argc, char** argv)
+{
+ // Verify that issue #17519 Setting CXX_STANDARD breaks CUDA_STANDARD
+ // selection via cxx_std_11 has been corrected
+ using returnv = std::integral_constant<int, 0>;
+ return returnv::value;
+}