summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2016-12-02 21:56:12 (GMT)
committerRobert Maynard <robert.maynard@kitware.com>2016-12-12 19:39:32 (GMT)
commit1371eec4c38b0a3b83f1416774c6c213ad0db6fc (patch)
tree7cdc524fe87bc18ddeb67f923f639881e1f0c07e /Tests/RunCMake
parent3d3d3f94703e23d3d2cbff67537057474e3e0ff1 (diff)
downloadCMake-1371eec4c38b0a3b83f1416774c6c213ad0db6fc.zip
CMake-1371eec4c38b0a3b83f1416774c6c213ad0db6fc.tar.gz
CMake-1371eec4c38b0a3b83f1416774c6c213ad0db6fc.tar.bz2
try_compile: extend CMP0067 to honor language standards for CUDA.
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/try_compile/CudaStandard-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/CudaStandard-stderr.txt7
-rw-r--r--Tests/RunCMake/try_compile/CudaStandard.cmake7
-rw-r--r--Tests/RunCMake/try_compile/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/try_compile/src.cu4
6 files changed, 23 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 1b88d46..adfd37d 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -222,6 +222,7 @@ foreach(var
CMAKE_CXX_COMPILER_ID
CMAKE_CXX_COMPILER_VERSION
CMAKE_CXX_STANDARD_DEFAULT
+ CMake_TEST_CUDA
)
if(DEFINED ${var})
list(APPEND try_compile_ARGS -D${var}=${${var}})
diff --git a/Tests/RunCMake/try_compile/CudaStandard-result.txt b/Tests/RunCMake/try_compile/CudaStandard-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/try_compile/CudaStandard-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_compile/CudaStandard-stderr.txt b/Tests/RunCMake/try_compile/CudaStandard-stderr.txt
new file mode 100644
index 0000000..3c6bdf6
--- /dev/null
+++ b/Tests/RunCMake/try_compile/CudaStandard-stderr.txt
@@ -0,0 +1,7 @@
+^CMake Error at .*/Tests/RunCMake/try_compile/CudaStandard-build/CMakeFiles/CMakeTmp/CMakeLists.txt:[0-9]+ \(add_executable\):
+ CUDA_STANDARD is set to invalid value '3'
++
+CMake Error at CudaStandard.cmake:[0-9]+ \(try_compile\):
+ Failed to generate test project build system.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/try_compile/CudaStandard.cmake b/Tests/RunCMake/try_compile/CudaStandard.cmake
new file mode 100644
index 0000000..96da422
--- /dev/null
+++ b/Tests/RunCMake/try_compile/CudaStandard.cmake
@@ -0,0 +1,7 @@
+enable_language(CUDA)
+try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
+ SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.cu
+ CUDA_STANDARD 3
+ OUTPUT_VARIABLE out
+ )
+message("try_compile output:\n${out}")
diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
index d1b0217..5452e6d 100644
--- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake
+++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
@@ -35,6 +35,9 @@ if(CMAKE_CXX_STANDARD_DEFAULT)
elseif(DEFINED CMAKE_CXX_STANDARD_DEFAULT)
run_cmake(CxxStandardNoDefault)
endif()
+if(CMake_TEST_CUDA)
+ run_cmake(CudaStandard)
+endif()
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4)
run_cmake(CStandardGNU)
endif()
diff --git a/Tests/RunCMake/try_compile/src.cu b/Tests/RunCMake/try_compile/src.cu
new file mode 100644
index 0000000..f8b643a
--- /dev/null
+++ b/Tests/RunCMake/try_compile/src.cu
@@ -0,0 +1,4 @@
+int main()
+{
+ return 0;
+}