Skip to content

Add C settings to the package manifest.#1798

Open
grynspan wants to merge 1 commit into
mainfrom
jgrynspan/add-c-settings-to-package
Open

Add C settings to the package manifest.#1798
grynspan wants to merge 1 commit into
mainfrom
jgrynspan/add-c-settings-to-package

Conversation

@grynspan

Copy link
Copy Markdown
Contributor

This PR adds C settings to the package manifest. This is necessary because when Swift processes a C header, it does so as C rather than as C++, and our C++ settings don't get applied.

I've also factored out setting the Swift, C, and C++ settings for all targets to a separate .map {} call so that we don't have to remember which target types have which factory function arguments and don't accidentally omit settings from new targets in the future.

CMake is not impacted.

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

This PR adds C settings to the package manifest. This is necessary because when
Swift processes a C header, it does so _as C_ rather than as C++, and our C++
settings don't get applied.

I've also factored out setting the Swift, C, and C++ settings for all targets to
a separate `.map {}` call so that we don't have to remember which target types
have which factory function arguments and don't accidentally omit settings from
new targets in the future.
@grynspan grynspan added this to the Swift 6.5.0 (main) milestone Jul 16, 2026
@grynspan grynspan self-assigned this Jul 16, 2026
@grynspan grynspan added the enhancement New feature or request label Jul 16, 2026
@grynspan grynspan added the build 🧱 Affects the project's build configuration or process label Jul 16, 2026
@grynspan
grynspan requested a review from harlanhaskins as a code owner July 16, 2026 15:22
Comment thread Package.swift
// it can only enable Library Evolution itself on those platforms.
swiftSettings += .enableLibraryEvolution(.whenApple())
} else {
swiftSettings += .enableLibraryEvolution()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The targets swift-testing-harness and SymbolShowcase don't currently have or need Library Evolution enabled, but they aren't test targets so I think under this logic they would get that enabled needlessly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build 🧱 Affects the project's build configuration or process enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants