| 1 |
enable_language (OBJCXX) |
| 2 |
include(CheckOBJCXXSourceCompiles) |
| 3 |
|
| 4 |
set(OBJCXX 1) # test that this is tolerated |
| 5 |
|
| 6 |
check_objcxx_source_compiles("I don't build in Objective-C++" SHOULD_FAIL) |
| 7 |
if(SHOULD_FAIL) |
| 8 |
message(SEND_ERROR "invalid OBJCXX source didn't fail.") |
| 9 |
endif() |
| 10 |
|
| 11 |
check_objcxx_source_compiles([[ |
| 12 |
#include <vector> |
| 13 |
#import <Foundation/Foundation.h> |
| 14 |
int main() { |
| 15 |
std::vector<int> v; |
| 16 |
NSObject *foo; |
| 17 |
return 0; |
| 18 |
} |
| 19 |
]] SHOULD_BUILD) |
| 20 |
|
| 21 |
|
| 22 |
if(NOT SHOULD_BUILD) |
| 23 |
message(SEND_ERROR "Test fail for OBJCXX source.") |
| 24 |
endif() |