A tiny C command-line tool that scaffolds new C projects with a
src/, include/, and CMake-based build setup. No manual directory
juggling or boilerplate typing.
Running newc <project-name> generates:
<project-name>/
├── CMakeLists.txt # C11, warnings on, ASan+UBSan in debug builds
├── src/
│ └── main.c # includes the matching header, prints a hello
├── include/
│ └── <project-name>.h # header guard already set up
├── .gitignore # ignores out/, compile_commands.json, *.o
└── out/ # empty, ready for cmake's output (matches
# Neovim's cmake-tools plugin default)
You can use the install.sh script to install newc on your system:
curl -fsSL https://raw.githubusercontent.com/rivethorn/newc/main/install.sh | bashFirst clone the repo:
git clone https://github.com/rivethorn/newc.git && cd newcThen:
cmake -B out && cmake --build out
sudo cmake --install outOr if you want to use make:
make install # builds newc.c and installs to /usr/local/binOther Makefile targets:
| Command | What it does |
|---|---|
make build |
Compiles newc.c into a local newc binary |
make install |
Builds (if needed) and installs to $PREFIX/bin (default /usr/local) |
make clean |
Removes the local newc binary |
make uninstall |
Removes the installed binary |
To install somewhere other than /usr/local:
make install PREFIX=$HOME/.localMake sure the install location is on your PATH.
newc my-cool-app
cd my-cool-app
cmake -S . -B out
cmake --build out
./out/my-cool-app- Project names with hyphens or other non-alphanumeric characters are
automatically sanitized into valid C header guards
(e.g.
password-vault→PASSWORD_VAULT_H). CMakeLists.txtusesfile(GLOB ...)to pick up source files, so adding new.cfiles tosrc/later doesn't require editing the build config.- Re-running
newcon a name that already exists will fail safely without overwriting anything.
MIT — see LICENSE.