Host application symbols are not reachable from test project for OS X bundle
I have downloaded this : https://gitlab.kitware.com/cmake/cmake/tree/master/Tests/XCTest and modified AppDelegate.h : https://gitlab.kitware.com/cmake/cmake/blob/master/Tests/XCTest/CocoaExample/AppDelegate.h :
#import <Cocoa/Cocoa.h>`
@interface AppDelegate : NSObject<NSApplicationDelegate>
- (int)mysqrt:(int)n;
@end
and https://gitlab.kitware.com/cmake/cmake/blob/master/Tests/XCTest/CocoaExample/AppDelegate.m :
...
- (int)mysqrt:(int)n {
return sqrt(n);
}
@end
and added one more test to : https://gitlab.kitware.com/cmake/cmake/blob/master/Tests/XCTest/CocoaExampleTests/CocoaExampleTests.m :
#import "../CocoaExample/AppDelegate.h"
...
- (void)testExample2323 {
AppDelegate * ad = [AppDelegate new];
XCTAssertEqual([ad mysqrt:1024], 32);
}
after this I ran :
> cmake .
> make
> ctest
the result is that the test fails :
> ctest
Test project /Users/cs/Downloads/CMake-master/Tests/XCTest
Start 1: XCTest.FrameworkExample
1/3 Test #1: XCTest.FrameworkExample .......... Passed 0.25 sec
Start 2: XCTest.CocoaExample
2/3 Test #2: XCTest.CocoaExample ..............***Failed 0.05 sec
Start 3: XCTest.StaticLibExample
3/3 Test #3: XCTest.StaticLibExample .......... Passed 0.16 sec
67% tests passed, 1 tests failed out of 3
Total Test time (real) = 0.46 sec
The following tests FAILED:
2 - XCTest.CocoaExample (Failed)
Errors while running CTest
The actual error is :
----------------------------------------------------------
2/3 Testing: XCTest.CocoaExample
2/3 Test: XCTest.CocoaExample
Command: "/Applications/Xcode.app/Contents/Developer/usr/bin/xctest" "/Users/cs/Downloads/CMake-master/Tests/XCTest/CocoaExampleTests.xctest"
Directory: /Users/cs/Downloads/CMake-master/Tests/XCTest
"XCTest.CocoaExample" start time: Jun 01 07:30 CEST
Output:
----------------------------------------------------------
2018-06-01 07:30:35.720 xctest[10327:786879] The bundle “” couldn’t be loaded. Try reinstalling the bundle.
2018-06-01 07:30:35.720 xctest[10327:786879] (dlopen(/Users/cs/Downloads/CMake-master/Tests/XCTest/CocoaExampleTests.xctest/Contents/MacOS/CocoaExampleTests, 265): Symbol not found: _OBJC_CLASS_$_AppDelegate
Referenced from: /Users/cs/Downloads/CMake-master/Tests/XCTest/CocoaExampleTests.xctest/Contents/MacOS/CocoaExampleTests
Expected in: /Applications/Xcode.app/Contents/Developer/usr/bin/xctest
in /Users/cs/Downloads/CMake-master/Tests/XCTest/CocoaExampleTests.xctest/Contents/MacOS/CocoaExampleTests)
<end of output>
Test time = 0.05 sec
----------------------------------------------------------
Test Failed.
"XCTest.CocoaExample" end time: Jun 01 07:30 CEST
"XCTest.CocoaExample" time elapsed: 00:00:00
----------------------------------------------------------
As I see the host application should be set correctly to make the host application symbols available in the test project.
When I generate the actual Xcode project using :
> cmake ./ -G Xcode
I see that the test bundle's host application is set to "custom". When I try to modify it so it is the CocoaExample app, the compilation fails with :
File not found: /Users/cs/Downloads/CMake-master/Tests/XCTest/Debug/CocoaExample.app/Contents/PlugIns/CocoaExample.app/Contents/MacOS/CocoaExample
Could you please help about how can someone reach the host application's symbols?