The missing CMake project initializer
Project description
cmake-init
🚀 Generate modern CMake projects with best practices built-in
Powered by UV - the fast Python package manager.
Quick Start
# 1. Install UV
curl -LsSf https://astral.sh/uv/install.sh | sh
# 2. Clone & Setup
git clone https://github.com/Guo-astro/cmake-start.git
cd cmake-start
./tasks.sh setup
# 3. Create a project
uv run cmake-init my-project
# 4. Build it
cd my-project
cmake --preset=dev
cmake --build --preset=dev
Usage
# C++ executable (default)
uv run cmake-init my-app
# C++ library
uv run cmake-init -s my-lib
# C++ header-only library
uv run cmake-init -h my-headers
# C project
uv run cmake-init --c my-c-app
# C++20 standard
uv run cmake-init --std 20 my-modern-app
# With Conan/vcpkg
uv run cmake-init -p conan my-app
Important: Project names must be lowercase (e.g., my-project, not MyProject)
Installing Code Quality Tools (Optional)
These tools are auto-detected - your project will build fine without them, but they provide extra code checking:
clang-tidy
# macOS
brew install llvm
# Ubuntu/Debian
sudo apt install clang-tidy
# Fedora
sudo dnf install clang-tools-extra
# NixOS
nix-env -iA nixpkgs.clang-tools
# Windows
choco install llvm
cppcheck
# macOS
brew install cppcheck
# Ubuntu/Debian
sudo apt install cppcheck
# Fedora
sudo dnf install cppcheck
# NixOS
nix-env -iA nixpkgs.cppcheck
# Windows
choco install cppcheck
When you run cmake --preset=dev, you'll see:
-- Found clang-tidy: /path/to/clang-tidy
-- Found cppcheck: /path/to/cppcheck
-- Code quality tools status:
-- clang-tidy: ON
-- cppcheck: ON
If tools aren't found, they're automatically disabled with installation instructions.
Development
Project Structure
cmake-start/
├── cmake-init/ ← Edit these files
│ ├── cmake_init.py
│ ├── template.py
│ └── templates/
│
├── src/cmake_init_lib/ ← Auto-generated (don't edit)
│ ├── cmake_init.py
│ ├── template.py
│ └── cmake-init.zip
│
└── build.py ← Builds everything
Making Changes
# 1. Edit source files
vim cmake-init/cmake_init.py
vim cmake-init/templates/common/cmake/code-quality.cmake
# 2. Rebuild (copies files + creates template ZIP)
python build.py
# 3. Test
uv run cmake-init test-project
Single source of truth: Always edit files in cmake-init/, then run python build.py
Common Issues
"ModuleNotFoundError"
./fix-editable.sh
"Changes not working"
python build.py # Run after editing cmake-init/
"Invalid project name"
# Bad: uv run cmake-init MyProject
# Good: uv run cmake-init my-project
NixOS build errors
export CXX=clang++
cmake --preset=dev
Commands Reference
| Command | Description |
|---|---|
uv run cmake-init my-app |
Create C++ executable |
uv run cmake-init -s my-lib |
Create C++ library |
uv run cmake-init -h my-headers |
Create header-only library |
uv run cmake-init --c my-c-app |
Create C project |
uv run cmake-init --std 20 my-app |
Use C++20 |
uv run cmake-init -p conan my-app |
Use Conan package manager |
uv run cmake-init --version |
Show version |
python build.py |
Build after editing templates |
python release.py patch |
Release new version to PyPI |
./tasks.sh setup |
Initial setup |
./fix-editable.sh |
Fix import errors |
Releasing to PyPI
# Quick release (patch/minor/major)
python release.py patch # 0.42.0 → 0.42.1
# See RELEASE.md for full documentation
The script handles: version bump, build, git tag, PyPI publish, and GitHub push.
What Makes This Different?
✅ Auto-detects clang-tidy and cppcheck - no build failures
✅ Latest vcpkg - automatically fetches current baseline hash
✅ Fast - powered by UV (10-100x faster than pip)
✅ Modern - CMake presets, FetchContent-ready
✅ Developer-friendly - helpful error messages
✅ Cross-platform - macOS, Linux, Windows, NixOS
✅ Single source - edit cmake-init/, run build.py
Links
- CMake Documentation
- UV Documentation
- clang-tidy Docs
- cppcheck Manual
- Report Issues
- Original cmake-init
Made with ❤️ for developers who hate boilerplate
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cmake_start-1.0.1.tar.gz.
File metadata
- Download URL: cmake_start-1.0.1.tar.gz
- Upload date:
- Size: 94.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6cec6c6dd96c1a854d7f57a245a8ca6ff0cccc8dbd202233b4e6b4dcbe6175c
|
|
| MD5 |
31e17dfd8d0e60a980fba0525408ec6a
|
|
| BLAKE2b-256 |
193727e27f43f94f3deb2faf48379e9ad20fc39515188928b36dc4982fb012a3
|
File details
Details for the file cmake_start-1.0.1-py3-none-any.whl.
File metadata
- Download URL: cmake_start-1.0.1-py3-none-any.whl
- Upload date:
- Size: 57.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11a59939f48fd392129feb44575c560588ee3d96c232a5a2bca528e44384a913
|
|
| MD5 |
66e64ad96cd619d3947c237184182815
|
|
| BLAKE2b-256 |
0ee60c9698ae3c2ca6a066317870526164f070bcea73a29277d4bf4606631e91
|