CheckCSourceCompiles.cmake 329 B

12345678910111213
  1. enable_language (C)
  2. include(CheckSourceCompiles)
  3. check_source_compiles(C "I don't build" SHOULD_FAIL)
  4. if(SHOULD_FAIL)
  5. message(SEND_ERROR "invalid C source didn't fail.")
  6. endif()
  7. check_source_compiles(C "int main() {return 0;}" SHOULD_BUILD)
  8. if(NOT SHOULD_BUILD)
  9. message(SEND_ERROR "Test fail for valid C source.")
  10. endif()