Skip to content

build(cmake): define xrt-pthreads before displayxr_mcp FetchContent#209

Open
dfattal wants to merge 1 commit into
mainfrom
fix/mingw-mcp-pthreads-order
Open

build(cmake): define xrt-pthreads before displayxr_mcp FetchContent#209
dfattal wants to merge 1 commit into
mainfrom
fix/mingw-mcp-pthreads-order

Conversation

@dfattal
Copy link
Copy Markdown
Collaborator

@dfattal dfattal commented May 6, 2026

Summary

  • Closes MinGW compile-check fails: displayxr_mcp pthreads check runs before xrt-pthreads target is defined #208. Moves the add_library(xrt-pthreads INTERFACE) block above FetchContent_MakeAvailable(displayxr_mcp) so displayxr_mcp/CMakeLists.txt:87's if(TARGET xrt-pthreads) check resolves on every platform — including MinGW cross-compile, where neither xrt-pthreads (not yet defined) nor vcpkg's PThreads4W (no vcpkg on the toolchain) was reachable, leading to FATAL_ERROR at configure.
  • MSVC behavior unchanged: xrt-pthreads already wraps PThreads4W::PThreads4W_CXXEXC for the MSVC branch, so the link chain through xrt-pthreads is the same as the previous direct PThreads4W::PThreads4W resolution downstream did.
  • MinGW now resolves to Threads::Threads (winpthreads), which is the correct fallback the previous ordering made unreachable.

Note: marking this PR ready (not draft) since it's a small, self-contained CMake-ordering change with no MSVC behavior delta.

Test plan

  • Local: ./scripts/build-mingw-check.sh aux_util now progresses past the displayxr_mcp pthreads check (next failure is a separate, pre-existing cJSON IMPORTED_IMPLIB issue on the Homebrew env — out of scope for this PR).
  • CI Windows + macOS builds green on this PR (no behavior change expected).

🤖 Generated with Claude Code

…208)

displayxr_mcp/CMakeLists.txt:87 checks `if(TARGET xrt-pthreads)` first
and falls back to vcpkg `PThreads4W` if absent. The runtime defined
xrt-pthreads at line 171 of root CMakeLists.txt — *after*
FetchContent_MakeAvailable(displayxr_mcp) at line 129 — so the target
didn't exist when displayxr_mcp configured. MSVC builds masked this
because vcpkg supplies PThreads4W; MinGW cross-compile (used by
scripts/build-mingw-check.sh) hit FATAL_ERROR every time.

Move the xrt-pthreads block above FetchContent_MakeAvailable so the
target exists when displayxr_mcp's check runs. The link-target chain
is functionally identical for MSVC (xrt-pthreads → PThreads4W_CXXEXC),
and on MinGW it now resolves to Threads::Threads (winpthreads), which
is the right behavior the previous order made unreachable.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dfattal dfattal enabled auto-merge (squash) May 6, 2026 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MinGW compile-check fails: displayxr_mcp pthreads check runs before xrt-pthreads target is defined

1 participant