Skip to content

Conversation

@zynfly
Copy link
Contributor

@zynfly zynfly commented Feb 10, 2026

Summary

Split from #49890 — this PR extracts the PowerShell Core tool acquisition portion as an independent change.

  • Add vcpkg_find_acquire_program(PWSH) module for standardized PowerShell Core acquisition via vcpkg's tool infrastructure
  • Replace hardcoded find_program(pwsh) in vcpkg_copy_tool_dependencies.cmake with vcpkg_find_acquire_program(PWSH), eliminating build failures when PowerShell is not pre-installed on the host
  • Add PowerShell Core 7.5.4 platform definitions in vcpkg-tools.json for Windows x86, Linux x64/arm64, and macOS x64/arm64 (Windows x64/arm64 entries already existed)

Problem

When cross-compiling Windows targets from macOS or Linux, vcpkg_copy_tool_dependencies fails with:

Could not find PowerShell Core; please open an issue to report this.

PowerShell is required for dependency deployment scripts but the previous code assumed pwsh was already available on the host system via find_program().

Solution

Use vcpkg's existing tool acquisition infrastructure (vcpkg_find_acquire_program / z_use_vcpkg_fetch) to automatically download and configure PowerShell Core 7.5.4 when needed. This follows the same pattern used by other vcpkg tools (cmake, ninja, git, etc.) and ensures PowerShell is available on any supported platform without requiring manual installation.

Changes

File Description
scripts/cmake/vcpkg_find_acquire_program(PWSH).cmake New module: maps PWSH to powershell-core tool fetch
scripts/cmake/vcpkg_copy_tool_dependencies.cmake Replace find_program(pwsh) + FATAL_ERROR with vcpkg_find_acquire_program(PWSH)
scripts/vcpkg-tools.json Add 5 new powershell-core entries (win-x86, linux-x64, linux-arm64, osx-x64, osx-arm64)

Test plan

Tested on macOS ARM64 and Linux x64. SHA-512 hashes verified locally against official GitHub release archives for both platforms.

🤖 Generated with Claude Code

…uilds

Enables automatic download and configuration of PowerShell Core 7.5.4 when
needed for cross-platform builds. This fixes build failures when compiling
Windows targets from macOS/Linux, where PowerShell is required for dependency
deployment scripts but was previously unavailable.

Changes:
- Add vcpkg_find_acquire_program(PWSH) for standardized PowerShell acquisition
- Update vcpkg_copy_tool_dependencies.cmake to use vcpkg tool infrastructure
- Add PowerShell Core 7.5.4 definitions for all platforms in vcpkg-tools.json
  (Windows x86/x64/arm64, Linux x64/arm64, macOS x64/arm64)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@zynfly zynfly force-pushed the feature/pwsh-tool-z-use-vcpkg-fetch branch from 0d10490 to e167b50 Compare February 11, 2026 12:27
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.

1 participant