build(cmake): define xrt-pthreads before displayxr_mcp FetchContent#209
Open
dfattal wants to merge 1 commit into
Open
build(cmake): define xrt-pthreads before displayxr_mcp FetchContent#209dfattal wants to merge 1 commit into
dfattal wants to merge 1 commit into
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
add_library(xrt-pthreads INTERFACE)block aboveFetchContent_MakeAvailable(displayxr_mcp)sodisplayxr_mcp/CMakeLists.txt:87'sif(TARGET xrt-pthreads)check resolves on every platform — including MinGW cross-compile, where neitherxrt-pthreads(not yet defined) nor vcpkg'sPThreads4W(no vcpkg on the toolchain) was reachable, leading to FATAL_ERROR at configure.xrt-pthreadsalready wrapsPThreads4W::PThreads4W_CXXEXCfor the MSVC branch, so the link chain throughxrt-pthreadsis the same as the previous directPThreads4W::PThreads4Wresolution downstream did.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
./scripts/build-mingw-check.sh aux_utilnow progresses past the displayxr_mcp pthreads check (next failure is a separate, pre-existing cJSONIMPORTED_IMPLIBissue on the Homebrew env — out of scope for this PR).🤖 Generated with Claude Code