johalun / sysctl-rs

A simplified Rust interface to the sysctl system call
MIT License
51 stars 23 forks source link

target_os groups? #71

Open johalun opened 2 months ago

johalun commented 2 months ago

Is there such a thing, or can such a thing be created that will allow us to do

#[cfg(not(any(target_os = "apple-like")))]

or

#[cfg(not(any(target_vendor = "apple")))]

instead of

#[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "visionos")))]
asomers commented 2 months ago

Yes. Just use the cfg-aliases crate. See https://github.com/nix-rust/nix/blob/master/build.rs for a usage example.

johalun commented 2 months ago

Nice, thanks!