5
votes

Assume I want my executable to be named "index.cgi" (or any other name which is not a correct Rust crate name) and to be built with Cargo.
Is there any way in Cargo to specify a name of output executable, or rename an executable in a post-build step? The documentation of Cargo is very scarce and I haven't found anything there. (A brief look at the sources didn't helped much too.)

1
I don't think it is possible now. You can try creating a feature request in Cargo issue tracker. - Vladimir Matveev

1 Answers

4
votes

The crate name and executable names must both be valid Rust identifiers.


You can set the name of an output executable (see 'Configuring a target' in the documentation for Cargo's manifest format), but it also has to be a valid identifier.

[[bin]]
name = "index.cgi"
path = "src/main.rs"