# Cross-platform support for Swift and XCTest

**URL:** https://discourse.cmake.org/t/cross-platform-support-for-swift-and-xctest/10052
**Category:** Development
**Created:** [February 11, 2024, 5:08am UTC](https://discourse.cmake.org/t/cross-platform-support-for-swift-and-xctest/10052 "2024-02-11T05:08:23Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![dabrahams](https://discourse.cmake.org/user_avatar/discourse.cmake.org/dabrahams/32/4265_2.png) [@dabrahams](https://discourse.cmake.org/u/dabrahams)
#### Post date: [February 17, 2024, 7:28pm UTC](https://discourse.cmake.org/t/cross-platform-support-for-swift-and-xctest/10052/3 "2024-02-17T19:28:30Z")

</div>

> [@ben.boeckel](#):
>
> Do you think this is best done as a module like `FindGTest` and its CMake API or something built-in for CMake (i.e., C++ code)? We do now have an experimental feature gate mechanism to aid in deploying this without committing to a stable interface if that would help get more feedback.

Definitely no need to write new C++ code in this case! As noted [here](https://discourse.cmake.org/t/the-testee-of-xctest-add-bundle/10120) I view this mostly as a modernization of the existing `FindXCTest` so I think `FindXCTest` (or `FindSwiftXCTest` if my code can’t be made to work with Objective-C on macOS—I haven’t tried that) would be appropriate.

The one complication I see is that support for non-macOS platforms involves [building](https://github.com/hylo-lang/SwiftCMakeXCTesting/blob/12e64e0d1c7a422f01e4601eadefa743811e45f5/CMakeLists.txt#L24-L40) and running a code generator [written in Swift](https://github.com/hylo-lang/SwiftCMakeXCTesting/blob/main/Sources/GenerateXCTestMain.swift). I don’t know if there’s any precedent for including something like that in CMake… but ideally the whole thing belongs there.

---

_[View the full topic](https://discourse.cmake.org/t/cross-platform-support-for-swift-and-xctest/10052)._
