CheckCUDASourceRuns.cmake 519 B

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