Build configuration issue

My .cargo/config.toml looks like

[build]
rustflags = ["-C", "link-arg=-s"]

But I can't debug with striping. Of course, I can just comment this and when compiling release uncomment, but I wonder if I can make something like

[build.release]
rustflags = ["-C", "link-arg=-s"]

or something. I know that I can use build scripts, but that look a bit redundant to me.(Also I don't know build scripts)

Unfortunately Cargo doesn't yet support this. If you don't want to use a build script then the only other thing I can think of is using something like xtask.

1 Like

There's an unstable feature in nightly Cargo that allows strip to be set for release builds only: Unstable Features - The Cargo Book

2 Likes