diff options
author | Robert Maynard <robert.maynard@kitware.com> | 2020-09-24 19:31:55 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-10-08 12:30:59 (GMT) |
commit | da2622ff366e6089a98109c68ececac58d598b66 (patch) | |
tree | 8205c6455c1c996ccb39d6270b8de385a92e78bb /Tests/RunCMake/CheckSourceCompiles | |
parent | c61f820a7fb1b191fe5591805f7e53fc52424f93 (diff) | |
download | CMake-da2622ff366e6089a98109c68ececac58d598b66.zip CMake-da2622ff366e6089a98109c68ececac58d598b66.tar.gz CMake-da2622ff366e6089a98109c68ececac58d598b66.tar.bz2 |
CUDA: Add Support to SourceCompiles|Runs and CheckCompilerFlags
Diffstat (limited to 'Tests/RunCMake/CheckSourceCompiles')
-rw-r--r-- | Tests/RunCMake/CheckSourceCompiles/CheckCUDASourceCompiles.cmake | 27 | ||||
-rw-r--r-- | Tests/RunCMake/CheckSourceCompiles/RunCMakeTest.cmake | 4 |
2 files changed, 31 insertions, 0 deletions
diff --git a/Tests/RunCMake/CheckSourceCompiles/CheckCUDASourceCompiles.cmake b/Tests/RunCMake/CheckSourceCompiles/CheckCUDASourceCompiles.cmake new file mode 100644 index 0000000..1e6e6b2 --- /dev/null +++ b/Tests/RunCMake/CheckSourceCompiles/CheckCUDASourceCompiles.cmake @@ -0,0 +1,27 @@ + +enable_language (CUDA) +include(CheckSourceCompiles) + +check_source_compiles(CUDA "I don't build" SHOULD_FAIL) +if(SHOULD_FAIL) + message(SEND_ERROR "invalid CUDA source didn't fail.") +endif() + +check_source_compiles(CUDA [=[ + #include <vector> + __device__ int d_func() { } + int main() { + return 0; + } +]=] + SHOULD_BUILD) +if(NOT SHOULD_BUILD) + message(SEND_ERROR "Test fail for valid CUDA source.") +endif() + +check_source_compiles(CUDA "void l(char const (&x)[2]){}; int main() { l(\"\\n\"); return 0;}" + SHOULD_BUILD_COMPLEX) + +if(NOT SHOULD_BUILD_COMPLEX) + message(SEND_ERROR "Test fail for valid CUDA complex source.") +endif() diff --git a/Tests/RunCMake/CheckSourceCompiles/RunCMakeTest.cmake b/Tests/RunCMake/CheckSourceCompiles/RunCMakeTest.cmake index a574d7d..22cb466 100644 --- a/Tests/RunCMake/CheckSourceCompiles/RunCMakeTest.cmake +++ b/Tests/RunCMake/CheckSourceCompiles/RunCMakeTest.cmake @@ -15,6 +15,10 @@ if (CMAKE_Fortran_COMPILER_ID) run_cmake(CheckFortranSourceCompiles) endif() +if (CMake_TEST_CUDA) + run_cmake(CheckCUDASourceCompiles) +endif() + if(CMake_TEST_ISPC) run_cmake(CheckISPCSourceCompiles) endif() |