#cargo #cpp #cli #cargo-subcommand

bin+lib cargo-newcpp

A cargo plugin for creating new C++ projects

13 releases

new 0.5.3 Nov 2, 2024
0.5.2 Sep 30, 2023
0.4.27 Sep 30, 2023
0.4.26 Aug 10, 2023
0.2.17 Aug 3, 2023

#457 in Cargo plugins

Apache-2.0 OR MIT

39KB
347 lines

cargo newcpp

This tool extends Cargo to allow for the creation of new C++ projects in the spirit of cargo new <project>

Ensure that you have a fairly recent version of rust/cargo installed. On Ubuntu you might also want to install cmake and gcc or g++ so that you can actually build project.

If you'd like to kick the tires on the build feature (cargo buildcpp) you will want the following installed

sudo apt install gcc, g++, ninja-build, build-essential, cmake
cargo install cargo-newcpp

Create a new project

Create a new CPP project with the following command.

cargo newcpp <your_project_name>

This will output to the following default project scaffolding.

scaffolding

Building the CPP project with cargo

Once you've create the project, you can use the following example to build the project.

cd <your_project_name> 
cargo buildcpp

Dependencies

~3–4MB
~86K SLoC