How can I build multiple binaries with Cargo?

You can specify multiple binaries using [[bin]], as mentioned here:

name = "daemon"
path = "src/daemon/bin/"

name = "client"
path = "src/client/bin/"

Tip: If you instead put these files in src/bin/ and src/bin/, you’ll get two executables named daemon and client as Cargo compiles all files in src/bin into executables with the same name automatically. You need to specify names and paths like in the snippet above only if you don’t follow this convention.

Leave a Comment