From 38fa8ef6b6679955bf6e904144e92b826c648741 Mon Sep 17 00:00:00 2001
From: Gregor Jasny <gjasny@googlemail.com>
Date: Mon, 8 Dec 2014 13:33:02 +0100
Subject: [PATCH 3/3] Add XCTest Example
To: cmake-developers@cmake.org

---
 Tests/CocoaExample/CMakeLists.txt                  | 20 +++++++++++
 .../CocoaExampleTests/CocoaExampleTests.m          | 40 ++++++++++++++++++++++
 2 files changed, 60 insertions(+)
 create mode 100644 Tests/CocoaExample/CocoaExampleTests/CocoaExampleTests.m

diff --git a/Tests/CocoaExample/CMakeLists.txt b/Tests/CocoaExample/CMakeLists.txt
index fbd17cc..bc0091f 100644
--- a/Tests/CocoaExample/CMakeLists.txt
+++ b/Tests/CocoaExample/CMakeLists.txt
@@ -19,3 +19,23 @@ set_target_properties(CocoaExample PROPERTIES
   MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/CocoaExample/Info.plist.in
   RESOURCE "CocoaExample/Base.lproj/MainMenu.xib")
 
+
+set(CMAKE_XCODE_ATTRIBUTE_FRAMEWORK_SEARCH_PATHS "$(DEVELOPER_FRAMEWORKS_DIR)")
+
+
+add_library(CocoaExampleTest MODULE
+  CocoaExampleTests/CocoaExampleTests.m
+)
+
+find_library(XCTEST_FRAMEWORK XCTest)
+
+target_link_libraries(CocoaExampleTest "-framework Foundation" "-framework XCTest")
+
+set_target_properties(CocoaExampleTest PROPERTIES
+  BUNDLE_EXTENSION xctest
+  BUNDLE TRUE
+  XCTEST TRUE
+  TEST_HOST CocoaExample
+)
+
+add_dependencies(CocoaExampleTest CocoaExample) # todo add dependency within cmake
diff --git a/Tests/CocoaExample/CocoaExampleTests/CocoaExampleTests.m b/Tests/CocoaExample/CocoaExampleTests/CocoaExampleTests.m
new file mode 100644
index 0000000..3796820
--- /dev/null
+++ b/Tests/CocoaExample/CocoaExampleTests/CocoaExampleTests.m
@@ -0,0 +1,40 @@
+//
+//  CocoaExampleTests.m
+//  CocoaExampleTests
+//
+//  Created by Gregor Jasny (privat) on 08/12/14.
+//  Copyright (c) 2014 Gregor Jasny. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+#import <XCTest/XCTest.h>
+
+@interface CocoaExampleTests : XCTestCase
+
+@end
+
+@implementation CocoaExampleTests
+
+- (void)setUp {
+    [super setUp];
+    // Put setup code here. This method is called before the invocation of each test method in the class.
+}
+
+- (void)tearDown {
+    // Put teardown code here. This method is called after the invocation of each test method in the class.
+    [super tearDown];
+}
+
+- (void)testExample {
+    // This is an example of a functional test case.
+    XCTAssert(YES, @"Pass");
+}
+
+- (void)testPerformanceExample {
+    // This is an example of a performance test case.
+    [self measureBlock:^{
+        // Put the code you want to measure the time of here.
+    }];
+}
+
+@end
-- 
1.9.3 (Apple Git-50)

