diff options
author | Brad King <brad.king@kitware.com> | 2021-07-27 13:11:05 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-07-27 13:11:32 (GMT) |
commit | 675c1300914798042f761117ab6bcdafcb54afd1 (patch) | |
tree | 77e5edee43ba43281c7b53c075579c4fdc87ea80 /Tests | |
parent | f90e100b73da6322b68e2ddf92a7c8e5420ce481 (diff) | |
parent | 0b5301a778cb22b1179dd21d709494dfe74add41 (diff) | |
download | CMake-675c1300914798042f761117ab6bcdafcb54afd1.zip CMake-675c1300914798042f761117ab6bcdafcb54afd1.tar.gz CMake-675c1300914798042f761117ab6bcdafcb54afd1.tar.bz2 |
Merge topic 'FindXCTest-xcode-12.5' into release-3.21
0b5301a778 FindXCTest: Fix output directory for test bundle with Xcode 12.5
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6379
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/XcodeProject/RunCMakeTest.cmake | 11 | ||||
-rw-r--r-- | Tests/RunCMake/XcodeProject/XCTestAddBundle.cmake | 9 | ||||
-rw-r--r-- | Tests/RunCMake/XcodeProject/dummy_main.swift | 18 |
3 files changed, 33 insertions, 5 deletions
diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index 26714c4..ed8e725 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -407,11 +407,16 @@ if (XCODE_VERSION VERSION_GREATER_EQUAL 7.3) if(XCODE_VERSION VERSION_GREATER_EQUAL 12) xctest_add_bundle_test(Darwin macosx "1" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns") xctest_add_bundle_test(Darwin macosx "12" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns") - xctest_add_bundle_test(iOS iphoneos "1" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns") - xctest_add_bundle_test(iOS iphoneos "12" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>") + xctest_add_bundle_test(iOS iphonesimulator "1" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns") + if (XCODE_VERSION VERSION_LESS 12.5) + xctest_add_bundle_test(iOS iphonesimulator "12" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>") + else() + xctest_add_bundle_test(iOS iphonesimulator "12" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns") + endif() else() xctest_add_bundle_test(Darwin macosx "" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns") - xctest_add_bundle_test(iOS iphoneos "" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns") + xctest_add_bundle_test(iOS iphonesimulator "" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns") endif() endif() + # Please add macOS-only tests above before the device-specific tests. diff --git a/Tests/RunCMake/XcodeProject/XCTestAddBundle.cmake b/Tests/RunCMake/XcodeProject/XCTestAddBundle.cmake index 444c730..9114fee 100644 --- a/Tests/RunCMake/XcodeProject/XCTestAddBundle.cmake +++ b/Tests/RunCMake/XcodeProject/XCTestAddBundle.cmake @@ -1,9 +1,14 @@ enable_language(Swift) + +set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED NO) +set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") +set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) + find_package(XCTest REQUIRED) -add_executable(TestedApp MACOSX_BUNDLE EXCLUDE_FROM_ALL foo.swift) +add_executable(TestedApp MACOSX_BUNDLE dummy_main.swift) -xctest_add_bundle(TestingAppBundle TestedApp foo.swift) +xctest_add_bundle(TestingAppBundle TestedApp dummy_main.swift) get_target_property(_lib_output_dir TestingAppBundle LIBRARY_OUTPUT_DIRECTORY) diff --git a/Tests/RunCMake/XcodeProject/dummy_main.swift b/Tests/RunCMake/XcodeProject/dummy_main.swift new file mode 100644 index 0000000..1aaee42 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/dummy_main.swift @@ -0,0 +1,18 @@ +#if os(iOS) +import UIKit + +@UIApplicationMain +class MyApp: UIResponder, UIApplicationDelegate { +} + +#elseif os(macOS) +import SwiftUI + +@main +struct MyApp: App { + var body: some Scene { + WindowGroup { + } + } +} +#endif |