fortanix/rust-mbedtls

Check to set `CMAKE_TRY_COMPILE_TARGET_TYPE` too restrictive

MasterAwesome opened this issue · 1 comments

if target.starts_with("thumbv") && target.contains("none-eabi") {
// When building on Linux, -rdynamic flag is added automatically. Changing the
// CMAKE_SYSTEM_NAME to Generic avoids this.
cmk.define("CMAKE_SYSTEM_NAME", "Generic");
// The compiler test requires _exit which is not available. By just trying to
// compile a library, we can fix it.
cmk.define("CMAKE_TRY_COMPILE_TARGET_TYPE", "STATIC_LIBRARY");
}

Targets don't necessarily end with none-eabi for example, if I wanted to compile for aarch64-unknown-none using CFLAGS='-I <my_system_headers>' CC=clang cargo b --target aarch64-unknown-none this fails. I think this must be configurable instead.

Removing this check, for the same command above allows me to run mbedtls code on baremetal aarch64.

What solution you prefer? Make it configurable through env var?

Or could you create a PR for fixing this?