Cargo OS Conditional Dependencies


#1

I’m working on a library in which the API implementation is completely separate for Windows and Linux.

Unfortunately, the Linux implementation has crate dependencies which are broken on windows, but cargo refuses to continue the compilation on windows even though the crates are not used.

Is there a way to make cargo require different crates depending on OS?


#2

Yes, as stated in the Cargo Manifest documentation.


#3

Ah, yes somehow I missed the blurb detailing this exact scenario.

Thanks.