cmake/Tests/RunCMake/CheckSourceCompiles/CheckOBJCSourceCompiles.cmake

22 lines
475 B
CMake
Raw Normal View History

2021-09-14 00:13:48 +02:00
enable_language (OBJC)
2022-11-16 20:14:03 +01:00
include(CheckOBJCSourceCompiles)
2021-09-14 00:13:48 +02:00
set(OBJC 1) # test that this is tolerated
2022-11-16 20:14:03 +01:00
check_objc_source_compiles("I don't build in Objective-C" SHOULD_FAIL)
if(SHOULD_FAIL)
message(SEND_ERROR "invalid OBJC source didn't fail.")
endif()
check_objc_source_compiles([[
2021-09-14 00:13:48 +02:00
#import <Foundation/Foundation.h>
int main() {
NSObject *foo;
return 0;
}
]] SHOULD_BUILD)
if(NOT SHOULD_BUILD)
message(SEND_ERROR "Test fail for valid OBJC source.")
endif()