CheckOBJCSourceCompiles.cmake 475 B

123456789101112131415161718192021
  1. enable_language (OBJC)
  2. include(CheckOBJCSourceCompiles)
  3. set(OBJC 1) # test that this is tolerated
  4. check_objc_source_compiles("I don't build in Objective-C" SHOULD_FAIL)
  5. if(SHOULD_FAIL)
  6. message(SEND_ERROR "invalid OBJC source didn't fail.")
  7. endif()
  8. check_objc_source_compiles([[
  9. #import <Foundation/Foundation.h>
  10. int main() {
  11. NSObject *foo;
  12. return 0;
  13. }
  14. ]] SHOULD_BUILD)
  15. if(NOT SHOULD_BUILD)
  16. message(SEND_ERROR "Test fail for valid OBJC source.")
  17. endif()