rust-lang / cmake-rs

Rust build dependency for running cmake
https://docs.rs/cmake
Apache License 2.0
301 stars 121 forks source link

Fix for windows i686 cross-compilation target #180

Closed SoulSharer closed 1 year ago

SoulSharer commented 1 year ago

Was trying to cross-compile nng 1.0.1 crate with cargo build --target i686-pc-windows-gnu. It failed because cmake crate did not properly set CMAKE_SYSTEM_NAME define due to a failed match on target arch. Target supplied by CARGO_CFG_TARGET_ARCH is not i686 but x86. Additional reference used: https://doc.rust-lang.org/reference/conditional-compilation.html#target_arch.

SoulSharer commented 1 year ago

There are several places where i686 checked as well. However I hesitated to change them, since I can't test these paths.

thomcc commented 1 year ago

If it's clearly a target_arch check feel free to include it in the PR. That's never a valid value for CARGO_CFG_TARGET_ARCH

thomcc commented 1 year ago

But I think this code might have places where it pulls something out of env::var("TARGET")?.split('-'). But I might be thinking of something else.

SoulSharer commented 1 year ago

Just rechecked, that seems to be true, it does extract i686 from a supplied triplet. PR should be good as is then.