summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CheckSourceRuns/CheckOBJCXXSourceRuns.cmake
blob: b220166665cdf051fab8a3ac004846c950905419 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
enable_language (OBJCXX)
include(CheckOBJCXXSourceRuns)

set(OBJCXX 1) # test that this is tolerated

check_objcxx_source_runs("int main() {return 2;}" SHOULD_FAIL)
if(SHOULD_FAIL)
  message(SEND_ERROR "check_objcxx_source_runs succeeded, but should have failed.")
endif()

check_objcxx_source_runs([[
  #include <vector>
  #import <Foundation/Foundation.h>
  int main() {
    std::vector<int> v;
    NSObject *foo;
    return 0;
  }
]] SHOULD_BUILD)


if(NOT SHOULD_BUILD)
  message(SEND_ERROR "Test fail for OBJCXX source.")
endif()