| 1 |
|
| 2 |
enable_language (CUDA) |
| 3 |
include(CheckSourceCompiles) |
| 4 |
|
| 5 |
set(CUDA 1) # test that this is tolerated |
| 6 |
|
| 7 |
check_source_compiles(CUDA "I don't build" SHOULD_FAIL) |
| 8 |
if(SHOULD_FAIL) |
| 9 |
message(SEND_ERROR "invalid CUDA source didn't fail.") |
| 10 |
endif() |
| 11 |
|
| 12 |
check_source_compiles(CUDA [=[ |
| 13 |
#include <vector> |
| 14 |
__device__ int d_func() { } |
| 15 |
int main() { |
| 16 |
return 0; |
| 17 |
} |
| 18 |
]=] |
| 19 |
SHOULD_BUILD) |
| 20 |
if(NOT SHOULD_BUILD) |
| 21 |
message(SEND_ERROR "Test fail for valid CUDA source.") |
| 22 |
endif() |
| 23 |
|
| 24 |
check_source_compiles(CUDA "void l(char const (&x)[2]){}; int main() { l(\"\\n\"); return 0;}" |
| 25 |
SHOULD_BUILD_COMPLEX) |
| 26 |
|
| 27 |
if(NOT SHOULD_BUILD_COMPLEX) |
| 28 |
message(SEND_ERROR "Test fail for valid CUDA complex source.") |
| 29 |
endif() |