apple / swift-argument-parser

Straightforward, type-safe argument parsing for Swift
Apache License 2.0
3.3k stars 311 forks source link

Straightforward CMake build doesn't work on Mac and no instructions available. #626

Open dabrahams opened 5 months ago

dabrahams commented 5 months ago

Why this matters: I want to submit PRs that make this project more consumable as a dependency of other CMake projects. Without a baseline understanding of what is expected to work, I can't test my changes.

ArgumentParser version: the main branch Swift version: swift-driver version: 1.87.3 Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5) Target: arm64-apple-macosx14.0

Checklist

Steps to Reproduce

cmake -GNinja -S . -B .cmake-build -DBUILD_TESTING=1 -DBUILD_EXAMPLES=1 && 
  cmake --build .cmake-build && 
  ctest -V --test-dir .cmake-build

Expected behavior

Successful build and test.

Actual behavior

/Users/dave/src/swift-project/swift-argument-parser/Sources/ArgumentParserTestHelpers/TestHelpers.swift:14:8: error: no such module 'XCTest'
import XCTest
       ^
/Users/dave/src/swift-project/swift-argument-parser/Sources/ArgumentParserTestHelpers/TestHelpers.swift:14:8: error: no such module 'XCTest'
import XCTest
       ^
natecook1000 commented 3 months ago

As currently configured, SwiftPM is the supported tool for building and running tests on the Mac. If there's a way to expand CMake support, that would be great to see!

dabrahams commented 3 months ago

To be clear, this is not a request to make the straightforward cmake build work; it's a request that someone (like whoever added the CMake "support", such as it is) describe the circumstances under which they expect it to work. Without such a description, "expanding CMake support" as you put it —which is what I am ultimately trying to do—is impossible because I can't know if any given change is breaking something important. "CMake isn't officially supported" may be true enough but it doesn't begin to address the issue.

dabrahams commented 3 months ago

If there's a way to expand CMake support, that would be great to see!

@natecook1000 Maybe I should read this as, “whatever you, Dave, attest is improving CMake support, I'm likely to accept the PR unless it breaks our CI.” If that's what you mean, I don't need to worry about who else might be relying on the current CMake configuration. Is that the right interpretation?