Skip to content

Support cross compilation in build.rs

Fix the target check to use the CARGO_CFG_WINDOWS environment variable (as documented in 1) so that it checks the configuration of the package being built rather than the configuration of the build machine.

This makes cross compilation for Windows from Linux work correctly:

rustup target add x86_64-pc-windows-gnu cargo build --target=x86_64-pc-windows-gnu

Previously this would try to run pkg-config since the cfg check was based on the configuration of the platform where build.rs was running.

Merge request reports