A project template for cross-platform console/CLI applications in C++ using CLI11 for command-line parsing and vcpkg for dependencies.
- CLI11 — command-line parsing: options, flags,
--help,--version, validation - vcpkg — manifest-mode dependencies; no global install required
- CMake — one preset (default); build Debug or Release from the same tree
- fmt — formatted output (included)
- C++17-capable compiler (e.g. MSVC 2019+, GCC 9+, Clang 10+)
- CMake 3.10 or newer
- vcpkg — install and set
VCPKG_ROOTto your vcpkg directory
1. Configure (uses VCPKG_ROOT for the vcpkg toolchain):
cmake --preset default2. Build (choose Debug or Release):
# Debug
cmake --build build --config Debug
# Release
cmake --build build --config Release3. Run
- Windows:
.\build\Release\app.exeor.\build\Debug\app.exe - Linux/macOS:
./build/app(path may includeReleaseorDebugdepending on generator)
Example:
.\build\Release\app.exe --help
.\build\Release\app.exe --name "User" --verbose
.\build\Release\app.exe --version├── CMakeLists.txt # Build definition, vcpkg toolchain, CLI11 + fmt
├── CMakePresets.json # Configure preset (default → build/)
├── vcpkg.json # Dependencies: cli11, fmt
├── vcpkg-configuration.json
├── README.md
└── src/
└── main.cpp # Entry point (CLI11 app)
The sample app in src/main.cpp uses CLI11 and supports:
-n,--name— name to greet (default:World)-v,--verbose— verbose output-V,--version— show version-h,--help— show help (auto-generated by CLI11)
- Clone or copy this repository.
- Add options/flags in
main.cppwithapp.add_option(),app.add_flag(), or subcommands withapp.add_subcommand(). See CLI11 documentation. - Add dependencies in
vcpkg.jsonandCMakeLists.txtas needed. - Add source files under
src/; they are picked up automatically viafile(GLOB ...).
| Goal | Command |
|---|---|
| Configure | cmake --preset default |
| Build Debug | cmake --build build --config Debug |
| Build Release | cmake --build build --config Release |
| Clean | Delete the build/ directory and run configure again. |
- CLI11 — command line parser for C++11+
- vcpkg documentation — adding ports, triplets, manifest mode.
Use this template for any purpose. CLI11 is BSD-3-Clause; fmt and other vcpkg ports have their own licenses.