# Cross-compiling quick-lint-js

quick-lint-js' CMake build system supports cross-compiling. You can build Windows executables on Linux, or ARM executables on x86.

This document focuses on cross-compiling considerations specific to quick-lint-js. See CMake's documentation on cross compiling for general cross-compilation information.

This document uses the term build machine and target machine. If you are compiling on a Linux x86_64 machine and want quick-lint-js to run on a Windows x86 machine, then the build machine is Linux x86_64, and the target machine is Windows x86.

quick-lint-js has programs which run as part of the build. These programs must run on the build machine. When cross-compiling, you need to build these programs first for the build machine before building quick-lint-js for the target machine. To do this, configure CMake for the build machine and build the `quick-lint-js-build-tools` CMake target:

>     cmake -DCMAKE_BUILD_TYPE=Release -S . -B build-tools -G Ninja
>     cmake --build build-tools --config Release --target quick-lint-js-build-tools

After building the tools for the build machine, configure CMake for the target machine. Set the `QUICK_LINT_JS_USE_BUILD_TOOLS` CMake variable to the `build-tools` directory we created with the previous commands. For example:

>     cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=~/MyToolchain.cmake -DQUICK_LINT_JS_USE_BUILD_TOOLS="${PWD}/build-tools" -S . -B build -G Ninja
>     cmake --build build --config Release