Skip to content

Split public header packaging between framework and file set#382

Merged
kraenhansen merged 2 commits into
mainfrom
claude/issue-376-fix-d7f8dm
Jul 19, 2026
Merged

Split public header packaging between framework and file set#382
kraenhansen merged 2 commits into
mainfrom
claude/issue-376-fix-d7f8dm

Conversation

@kraenhansen

@kraenhansen kraenhansen commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator

Context

CMake 4.2 (the current default on GitHub's macos-latest runners) rejects the weak-node-api build with:

CMake Error in CMakeLists.txt:
  The file set "HEADERS", of type "HEADERS", is incompatible with the
  "FRAMEWORK" target "weak-node-api".

packages/weak-node-api/CMakeLists.txt attached the public headers to the target two ways at once — a modern FILE_SET HEADERS and the framework's legacy PUBLIC_HEADER (inside the if(APPLE) block that also sets FRAMEWORK TRUE). CMake 4.2 makes a HEADERS file set incompatible with a FRAMEWORK target, so the Apple build now errors.

As a temporary unblock, #374 / #375 / #377 pinned CMake to 4.1.2 on five macOS jobs. This fixes the root cause and removes those pins.

Changes

packages/weak-node-api/CMakeLists.txt

  • Hoisted the header list into a PUBLIC_HEADER_FILES variable (previously read back from the target's HEADER_SET property).
  • On Apple, ship the public headers via the framework's PUBLIC_HEADER property only — no FILE_SET HEADERS on the framework target. The header list is identical to before, so XCFramework packaging is unchanged.
  • On other platforms, keep the HEADERS file set for install packaging.
  • Added an explicit target_include_directories(... $<BUILD_INTERFACE:...>) so in-tree consumers (the C++ tests, which #include <weak_node_api.hpp>) still get the include paths the file set used to supply implicitly.

.github/workflows/check.yml

  • Reverted the macOS CMake 4.1.2 pin from all five jobs: unit-tests, weak-node-api-tests, test-ios, test-macos, test-ferric-apple-triplets.
  • Kept the CMAKE_VERSION env var — it still selects the Android SDK cmake package in test-android, unrelated to this issue.

Verification

Validated the non-Apple path end-to-end locally: generated the sources, then cmake -S . -B build-tests -DBUILD_TESTS=ON → build → ctest, all passing — including the test's #include <weak_node_api.hpp>, confirming the new target_include_directories propagates includes to consumers.

The Apple .framework / XCFramework build is exercised by this PR's macOS CI (hence the weak-node-api / Apple 🍎 / Ferric 🦀 labels). All four Apple framework-building jobs — Unit tests (macos-latest), Weak Node-API tests (macos-latest), Test app (iOS), and Test ferric Apple triplets — pass on the runner's default CMake, confirming the pin is no longer needed.

Note: test-macos (the MacOS 💻 label) is intentionally not applied. It currently fails to build the React Native macOS test app due to an unrelated fmt consteval error in RN's own C++ (Yoga / logger), which has nothing to do with this change. That's tracked separately.

Acceptance criteria

  • weak-node-api configures and builds on macOS with the runner's default CMake (no version pin) — validated by CI.
  • Reverted the macOS CMake pin from all affected jobs.
  • macOS .framework / XCFramework still ships the correct public headers (identical PUBLIC_HEADER list).

Closes #376

🤖 Generated with Claude Code

CMake 4.2 rejects a `HEADERS` file set on a `FRAMEWORK` target, which
broke every macOS job that builds the weak-node-api framework:

    CMake Error in CMakeLists.txt:
      The file set "HEADERS", of type "HEADERS", is incompatible with the
      "FRAMEWORK" target "weak-node-api".

The workaround pinned CMake to 4.1.2 on five macOS jobs (#374, #375,
#377, and the pre-existing test-macos pin). This fixes the root cause
instead.

On Apple, the public headers are shipped via the framework's
PUBLIC_HEADER property; other platforms use a HEADERS file set for
install packaging. The build-interface include directories that the
file set previously supplied to in-tree consumers (e.g. the C++ tests)
are now provided explicitly via target_include_directories, so both
branches build unchanged.

With the root cause fixed, revert the macOS CMake version pin from all
five jobs. CMAKE_VERSION is retained since it still selects the Android
SDK cmake package for test-android.

Closes #376

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Aq4PqMYq8cQTP9Lf43JiwH
@kraenhansen kraenhansen added CI Continuous integration Apple 🍎 Anything related to the Apple platform (iOS, macOS, Cocoapods, Xcode, XCFrameworks, etc.) Ferric 🦀 MacOS 💻 Anything related to the Apple MacOS platform or React Native MacOS support weak-node-api labels Jul 19, 2026 — with Claude
Empty commit to re-run the label-gated macOS jobs now that the labels
are applied, so the reverted CMake pin is validated on the runner's
default CMake.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Aq4PqMYq8cQTP9Lf43JiwH
@kraenhansen kraenhansen removed the MacOS 💻 Anything related to the Apple MacOS platform or React Native MacOS support label Jul 19, 2026 — with Claude
@kraenhansen kraenhansen self-assigned this Jul 19, 2026
@kraenhansen
kraenhansen merged commit 1dee1a0 into main Jul 19, 2026
16 of 17 checks passed
@kraenhansen
kraenhansen deleted the claude/issue-376-fix-d7f8dm branch July 19, 2026 19:16
kraenhansen pushed a commit that referenced this pull request Jul 19, 2026
Reconcile the pnpm-migrated check.yml with two changes that landed on main
while this branch was in review:

- #382 fixed the CMake 4.2 framework-HEADERS root cause in
  weak-node-api/CMakeLists.txt (included via the rebase) and removed the
  now-redundant "Install compatible CMake version" pin from all five macOS
  jobs. Drop those steps here too; CMAKE_VERSION is retained since
  test-android still uses it to select the Android SDK cmake package.
- #380 gated test-android to labeled PRs only (the ubuntu-self-hosted runner
  is offline and otherwise leaves the job queued forever on main).

With this, check.yml differs from main purely by the pnpm conversion.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DnwodAoNbqPec77191HVXn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Apple 🍎 Anything related to the Apple platform (iOS, macOS, Cocoapods, Xcode, XCFrameworks, etc.) CI Continuous integration Ferric 🦀 weak-node-api

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Revert CMake pin (#375) and properly fix HEADERS file set on FRAMEWORK target

2 participants