Skip to content

Comments

Support Windows.Clang.toolchain.cmake and Windows.Kits.cmake consumption from Linux#153

Merged
MarkSchofield merged 1 commit intomainfrom
mschofie/linux-cross-compile
Feb 3, 2026
Merged

Support Windows.Clang.toolchain.cmake and Windows.Kits.cmake consumption from Linux#153
MarkSchofield merged 1 commit intomainfrom
mschofie/linux-cross-compile

Conversation

@MarkSchofield
Copy link
Owner

#148 floated the idea of support for cross-compiling for Windows from Linux using the Windows.Clang.toolchain.cmake. After a few fixes - #149, #151, #152 - this PR sketches the approach.

  1. The VS_INSTALLATION_PATH variable needs to be set. This PR adds support when building on WSL to obtain the VS_INSTALLATION_PATH value using vswhere.exe on Windows.
  2. The CMAKE_WINDOWS_KITS_10_DIR variable needs to be set. This PR adds support when building on WSL to calculate CMAKE_WINDOWS_KITS_10_DIR by reading from the Windows OS registry.
  3. Linux values of CMAKE_SYSTEM_PROCESSOR need to be accommodated when calculating CMAKE_VS_PLATFORM_TOOLSET_ARCHITECTURE and WINDOWS_KITS_TARGET_ARCHITECTURE.
  4. Appropriate clang, mt and rc tools need to be specified.

This PR adds CMake presets showing cross-compilation from Linux for arm64 and x64, using clang-20 on WSL - leveraging the toolchain support for discovering a VS installation, and a Windows SDK.

@MarkSchofield MarkSchofield force-pushed the mschofie/linux-cross-compile branch from feff7a6 to d26d613 Compare February 3, 2026 06:16
@MarkSchofield MarkSchofield merged commit b11ba79 into main Feb 3, 2026
21 checks passed
@MarkSchofield MarkSchofield deleted the mschofie/linux-cross-compile branch February 3, 2026 06:38
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