Imported Upstream version 3.24.3
[platform/upstream/cmake.git] / Tests / RunCMake / CheckSourceRuns / CheckSourceRunsCUDA.cmake
1
2 enable_language (CUDA)
3 include(CheckSourceRuns)
4
5 set(CUDA 1) # test that this is tolerated
6
7 check_source_runs(CUDA "int main() {return 2;}" SHOULD_FAIL)
8 if(SHOULD_FAIL)
9   message(SEND_ERROR "CUDA check_source_runs succeeded, but should have failed.")
10 endif()
11
12 check_source_runs(CUDA
13 [=[
14   #include <vector>
15   __device__ __host__ void fake_function();
16   __host__ int main() {
17     return 0;
18   }
19 ]=]
20  SHOULD_RUN)
21 if(NOT SHOULD_RUN)
22   message(SEND_ERROR "CUDA check_source_runs failed for valid CUDA executable.")
23 endif()