Imported Upstream version 3.25.0
[platform/upstream/cmake.git] / Tests / RunCMake / CheckSourceRuns / CheckOBJCSourceRuns.cmake
1 enable_language (OBJC)
2 include(CheckOBJCSourceRuns)
3
4 set(OBJC 1) # test that this is tolerated
5
6 check_objc_source_runs("int main() {return 2;}" SHOULD_FAIL)
7 if(SHOULD_FAIL)
8   message(SEND_ERROR "check_objc_source_runs succeeded, but should have failed.")
9 endif()
10
11 check_objc_source_runs([[
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()