Bernard
Bernard

Reputation: 5676

Cargo build script to detect target min and max macOS version?

I'm writing a Rust wrapper for a C library that conditionally requires the UniformTypeIdentifiers framework depending on the values of __MAC_OS_X_VERSION_MIN_ALLOWED and __MAC_OS_X_VERSION_MAX_ALLOWED (which are the minimum and maximum macOS versions targeted). The C library does conditional compilation that uses the UniformTypeIdentifiers library (which was introduced recently) because the old way of doing things is now deprecated.

Is there a way to obtain these two values (the minimum and maximum macOS versions targeted) in build.rs so that I can decide whether to emit the cargo:rustc-link-lib=framework=UniformTypeIdentifiers line that links the library? I can't simply emit it all the time, because on older Macs this will lead to a build error, since the library would be unavailable.

Upvotes: 1

Views: 274

Answers (0)

Related Questions