Minor Cargo.toml questions

Minor issues:

  1. Is it possible to have Cargo build a Linux target with a name "example.fcgi"? I have to rename after each build. I don't see a way to set the suffix.

  2. When generating multple [bin] targets, is there any way to set a description for each target?

[[bin]]
name = "uploadterrain"           # The name of the target.
path = "src/server/uploadterrain.rs"    # The source file of the target.
# description = "This becomes uploadterrain.fcgi and runs on an Apache server under mod_fcgid"

Can't use description there.

I suspect the answer to both is "no".

Seems implemented on nightly but not stable.

2 Likes

I understand that this might not be helpful, but cargo is designed as a package manager tool, not a general build system. Even though this particular feature is implemented (but not stabilised yet) if you will need to do something more complex, you should wrap cargo inside some more feature-complete build system where you can control not only how your software is build, but also how it is distributed. For example cmake or meson.

3 Likes

What would you expect a bin-specific description to be used for? package.description is used in cases like crates.io, cargo search, cargo info, etc.

FYI we've debated how much we should improve the experience for independent build targets within the same package vs encouraging workspaces. We never ended up on an answer. See This Development-cycle in Cargo: 1.77 | Inside Rust Blog.

cmake. Oh, please, no. A big advantage of Rust is not needing makefiles.