Skip to content

Commit 2f08d21

Browse files
Allow of way to toggle freestanding platform features (#356)
* Allow of way to toggle freestanding platform features `RUST_MBED_C_COMPILER_FREESTANDING=1` allows to skip cmake checks where the target must produce valid binaries * Rename the env variable and don't affect features
1 parent 4ff64a0 commit 2f08d21

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

mbedtls-sys/build/cmake.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,16 @@ impl super::BuildConfig {
2828
cmk.define("CMAKE_C_COMPILER_FORCED", "TRUE");
2929
}
3030

31+
println!("cargo:rerun-if-env-changed=RUST_MBED_C_COMPILER_BAREMETAL");
32+
let c_compiler_baremetal = std::env::var("RUST_MBED_C_COMPILER_BAREMETAL")
33+
.map(|val| val == "1")
34+
.unwrap_or_default();
35+
3136
let target = std::env::var("TARGET").expect("TARGET environment variable should be set in build scripts");
3237
// thumbv6m-none-eabi, thumbv7em-none-eabi, thumbv7em-none-eabihf,
3338
// thumbv7m-none-eabi probably use arm-none-eabi-gcc which can cause the
3439
// cmake compiler test to fail.
35-
if target.starts_with("thumbv") && target.contains("none-eabi") {
40+
if target.starts_with("thumbv") && target.contains("none-eabi") || c_compiler_baremetal {
3641
// When building on Linux, -rdynamic flag is added automatically. Changing the
3742
// CMAKE_SYSTEM_NAME to Generic avoids this.
3843
cmk.define("CMAKE_SYSTEM_NAME", "Generic");

0 commit comments

Comments
 (0)