Merge topic 'xctest_static_framework'

bfa92e57 XCTest: Add support for static frameworks

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !732
This commit is contained in:
Brad King 2017-04-26 13:00:16 +00:00 committed by Kitware Robot
commit 380232e105
6 changed files with 67 additions and 0 deletions

View File

@ -123,6 +123,10 @@ function(xctest_add_bundle target testee)
# testee is a Framework
target_link_libraries(${target} PRIVATE ${testee})
elseif(_testee_type STREQUAL "STATIC_LIBRARY")
# testee is a static library
target_link_libraries(${target} PRIVATE ${testee})
elseif(_testee_type STREQUAL "EXECUTABLE" AND _testee_macosx_bundle)
# testee is an App Bundle
add_dependencies(${target} ${testee})

View File

@ -55,3 +55,19 @@ xctest_add_bundle(CocoaExampleTests CocoaExample
CocoaExampleTests/CocoaExampleTests.m)
xctest_add_test(XCTest.CocoaExample CocoaExampleTests)
# Static lib
add_library(StaticLibExample STATIC
StaticLibExample/StaticLibExample.h
StaticLibExample/StaticLibExample.c
)
target_include_directories(StaticLibExample PUBLIC .)
# XCTest for Static lib
xctest_add_bundle(StaticLibExampleTests StaticLibExample
StaticLibExampleTests/StaticLibExampleTests.m)
xctest_add_test(XCTest.StaticLibExample StaticLibExampleTests)

View File

@ -0,0 +1,6 @@
#include "StaticLibExample.h"
int FourtyFour()
{
return 44;
}

View File

@ -0,0 +1 @@
int FourtyFour();

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>StaticLibExampleTests</string>
<key>CFBundleIdentifier</key>
<string>org.cmake.StaticLibExampleTests</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>StaticLibExampleTests</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

View File

@ -0,0 +1,16 @@
#import <XCTest/XCTest.h>
#import "StaticLibExample/StaticLibExample.h"
@interface StaticLibExampleTests : XCTestCase
@end
@implementation StaticLibExampleTests
- (void)testFourtyFour {
// This is an example of a functional test case.
XCTAssertEqual(44, FourtyFour());
}
@end