BTC
ETH
SOL
BNB
GOLD
XRP
DOGE
ADA
Back to home
Tech

Show HN: I built a Cargo-like build tool for C/C++

C/C++ developers waste hours on build setup.

C/C++ developers waste hours on build setup. CMakeLists.txt files balloon with boilerplate, find_package calls fail mysteriously, and linking errors send you down Google rabbit holes. A new tool called Craft tackles this head-on. It uses a simple TOML config file to auto-generate CMake and handle dependencies, mimicking Rust’s Cargo for C and C++. Version 1.0.0 just dropped, cross-platform on macOS, Linux, and Windows.

This matters because C and C++ power critical systems—Linux kernel, game engines like Unreal, embedded firmware—yet lack a standard package manager. Rust’s Cargo solved onboarding friction: type cargo new, add deps, build. C++? You pick CMake, Meson, or Bazel, then wrestle deps via vcpkg, Conan, or system packages. Surveys like the 2023 Stack Overflow Developer Survey show C++ in the top 5 languages, but build complaints dominate forums. Craft aims to cut that first-hour momentum killer.

How Craft Works

You start with craft init in an empty directory or existing project. It creates craft.toml:

[project]
name = "my_app"
version = "0.1.0"
language = "c"
c_standard = 99

[build]
type = "executable"

Run craft build. Craft generates CMakeLists.txt, configures, and compiles. Add dependencies? Simple commands:

$ craft add --git https://github.com/raysan5/raylib --links raylib
$ craft add --path ../my_library
$ craft add sfml

Craft clones the repo or finds the package (SFML via some resolver), updates craft.toml, regenerates CMake, and rebuilds. Other commands: craft gen for boilerplate headers/sources, craft template to reuse project skeletons, craft upgrade for self-updates. For edge cases, drop a CMakeLists.extra.cmake file.

It hides CMake complexity while leaning on its ecosystem. No reinventing parsers for every compiler flag—Craft emits standard CMake. Tests on GitHub show it handles Raylib (graphics lib) and SFML (multimedia) out-of-box.

Strengths, Skepticism, and Why It Could Stick

Strengths first: Dead simple for prototypes. Hobbyists or solo devs starting a CLI tool or game jam entry save real time. Cross-platform without WSL hacks or MSYS2. craft add centralizes deps, reducing “works on my machine” issues. If it adds lockfiles (not in v1.0), reproducible builds follow—crucial for security in supply-chain attacks like XZ Utils backdoor attempts.

Skeptical side: It’s early. No mention of lockfiles, so craft add --git clones latest HEAD—supply chain risk if upstream changes. Package resolution for “sfml”? Relies on unlisted index; fails if Conan/vcpkg unavailable. Scales poorly for monorepos—Bazel owns that. CMake underneath means you still debug generated files sometimes. Benchmarks? None yet, but generating CMake adds overhead vs. native Meson (JSON-like declarative builds, faster Ninja backend).

Compare: Conan 2.0 (2023) manages binaries with conanfile.py/toml, vcpkg integrates with VS/CMake seamlessly. Meson declares deps simply, no generators. Craft differentiates with Cargo ergonomics—no Python deps like Conan, single binary. If it grows a registry (crates.io style), it wins for small teams.

Implications: Lowers C/C++ barrier for Rust devs crossing over. Speeds open-source contribs—fork, craft add, PR. Security angle: Unified dep fetching could enforce hashes/signatures, mitigating SolarWinds-style risks. But entrenched teams stick with CMake. Watch GitHub stars (starts at zero) and issues. PRs welcome, per author.

Try it if CMake grinds your gears. Download from GitHub, test on a toy project. Feedback shapes it—v1.0 needs battle-testing before prime time.

April 10, 2026 · 3 min · 12 views · Source: Hacker News

Related