Reputation: 3797
I'm depending on a crate that has build-override.opt-level = 3
set for all build profiles, because its build script takes very long to run with the default opt-level
for build scripts, which is 0
.
How do I make the build script compile with the same opt-level
value in a downstream binary?
Upvotes: 0
Views: 133
Reputation: 950
I'm not 100% sure if I got you right, but If your goal is to override the opt-level
for this very crate you are depending on, then you can override it in your crate Cargo.toml
this way:
# The `foo` package will use the -Copt-level=0 flag.
[profile.dev.package.foo]
opt-level = 0
This will only apply for the dev
profile and only take affects to a crate named foo
in your dependency tree.
Just in case, if this very crate you are depending on is only one of the build-dependencies
you must override it this way:
# Set the settings for build scripts and proc-macros.
[profile.dev.build-override]
opt-level = 0
This still applies for the dev
profile, but is not anymore dependency specific.
Read more about it in the docs: https://doc.rust-lang.org/cargo/reference/profiles.html?highlight=build-override#overrides
Upvotes: 0