How to pass the --sysroot flag to rustc

I have a core library compiled for a custom target, I want to change the sysroot path to this custom library, how to do ?

You probably want to set RUSTFLAGS for the respective crate or target.