Cargo [build] tags with rustflags question

Hi Guys,
How can i add both the linker with lld and native cpu,
e.g.

[build]
rustflags = ["-C", "target-cpu=native"] + rustflags = ["-C", "link-arg=-fuse-ld=lld"]

how can i use both of them
thanks

Do you have a more complex situation in mind than just setting both at the same time?

You can concatenate the arrays:

[build]
rustflags = ["-C", "target-cpu=native", "-C", "link-arg=-fuse-ld=lld"]

If you have per-target rustflags, you will have to add all the flags there. Cargo does not merge the flags.

https://doc.rust-lang.org/cargo/reference/config.html#buildrustflags

1 Like

Thanks @kornel

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.