Commit bfa92e57 authored by Guillaume Campagna's avatar Guillaume Campagna Committed by Brad King

XCTest: Add support for static frameworks

Fixes: #16636
parent b4d3cdc8
......@@ -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})
......
......@@ -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)
#include "StaticLibExample.h"
int FourtyFour()
{
return 44;
}
<?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>
#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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment