1
0

CheckCSourceCompiles.cmake 370 B

123456789101112131415
  1. enable_language (C)
  2. include(CheckCSourceCompiles)
  3. set(C 1) # test that this is tolerated
  4. check_c_source_compiles("I don't build" SHOULD_FAIL)
  5. if(SHOULD_FAIL)
  6. message(SEND_ERROR "invalid C source didn't fail.")
  7. endif()
  8. check_c_source_compiles("int main() {return 0;}" SHOULD_BUILD)
  9. if(NOT SHOULD_BUILD)
  10. message(SEND_ERROR "Test fail for valid C source.")
  11. endif()