|
CPGen
C++ project generator
|
A modern C++ project generator. Scaffold production-ready CMake projects with modules, tooling, and tests — from the CLI or an interactive TUI.
CMakeLists.txt with modern best practices (FetchContent, compile options, clang-tidy integration).clang-tidy, .clang-format (with preset support), .gitignoresrc/main.cpp, tests/test_main.cpp, README.md out of the boxThe binary is at build/CPGen. Templates are auto-copied next to the executable.
Launches an interactive terminal interface where you can configure the project name, output path, and tooling options before generating.
| Short | Long | Description |
|---|---|---|
-h | --help | Show help and exit |
-u | --tui | Launch interactive TUI mode |
-n | --name | Project name (must match ^\w+$) |
-p | --path | Output directory (must exist on disk) |
-s | --std | C++ standard: 17, 20, or 23 (default: 20) |
-m | --modules | Comma-separated modules: -m gtest,spdlog |
-tar | --targets | Comma-separated target types: -tar exe,test,lib |
-g | --git | Initialize a .gitignore |
-cf | --clang-format | Generate .clang-format |
-cfp | --cf-preset | Clang-format style preset (e.g. Google, LLVM) |
-ct | --clang-tidy | Generate .clang-tidy and CMake integration |
| Module | Description | Target |
|---|---|---|
gtest | Google Test framework | test |
catch2 | Catch2 v3 test framework | test |
spdlog | Fast C++ logging library | main |
fmt | Modern formatting library | main |
Create a JSON file at templates/modules/<name>/<name>.json:
Optional fields per target: cmake_include (e.g. "GoogleTest"), post_link (e.g. "gtest_discover_tests(${TARGET_NAME})").
MIT