johalun / sysctl-rs

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

target_os groups? #71

Open johalun opened 4 days ago

johalun commented 4 days 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 4 days 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 4 days ago

Nice, thanks!