diff options
Diffstat (limited to 'Tests/RunCMake/CheckSourceRuns')
-rw-r--r-- | Tests/RunCMake/CheckSourceRuns/CheckCUDASourceRuns.cmake | 21 | ||||
-rw-r--r-- | Tests/RunCMake/CheckSourceRuns/RunCMakeTest.cmake | 4 |
2 files changed, 25 insertions, 0 deletions
diff --git a/Tests/RunCMake/CheckSourceRuns/CheckCUDASourceRuns.cmake b/Tests/RunCMake/CheckSourceRuns/CheckCUDASourceRuns.cmake new file mode 100644 index 0000000..01e5ac8 --- /dev/null +++ b/Tests/RunCMake/CheckSourceRuns/CheckCUDASourceRuns.cmake @@ -0,0 +1,21 @@ + +enable_language (CUDA) +include(CheckSourceRuns) + +check_source_runs(CUDA "int main() {return 2;}" SHOULD_FAIL) +if(SHOULD_FAIL) + message(SEND_ERROR "CUDA check_source_runs succeeded, but should have failed.") +endif() + +check_source_runs(CUDA +[=[ + #include <vector> + __device__ __host__ void fake_function(); + __host__ int main() { + return 0; + } +]=] + SHOULD_RUN) +if(NOT SHOULD_RUN) + message(SEND_ERROR "CUDA check_source_runs failed for valid CUDA executable.") +endif() diff --git a/Tests/RunCMake/CheckSourceRuns/RunCMakeTest.cmake b/Tests/RunCMake/CheckSourceRuns/RunCMakeTest.cmake index 8bcde6a..b27b08d 100644 --- a/Tests/RunCMake/CheckSourceRuns/RunCMakeTest.cmake +++ b/Tests/RunCMake/CheckSourceRuns/RunCMakeTest.cmake @@ -14,3 +14,7 @@ endif() if (CMAKE_Fortran_COMPILER_ID) run_cmake(CheckFortranSourceRuns) endif() + +if (CMake_TEST_CUDA) + run_cmake(CheckCUDASourceRuns) +endif() |