It's easy to forget about the hidden .cargo/config.toml file, and setting the linker flags in build.rs also means they can be changed without requiring a rebuild of everything, they are more robust to running the build from a location where .cargo/config.toml isn't picked up, and they make it easier to support different linker arguments for different crates or binaries.
It's easy to forget about the hidden
.cargo/config.toml
file, and setting the linker flags in build.rs also means they can be changed without requiring a rebuild of everything, they are more robust to running the build from a location where.cargo/config.toml
isn't picked up, and they make it easier to support different linker arguments for different crates or binaries.Thanks to @Dirbaio for the suggestion!