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