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

https://github.com/randerson112/craft

GitHub - randerson112/craft: A lightweight build and workflow tool for C/C++

A lightweight build and workflow tool for C/C++. Contribute to randerson112/craft development by creating an account on GitHub.

GitHub

The least painful C/C++ build tool I've used is xmake

https://github.com/xmake-io/xmake

The reason why I like it (beyond ease-of-use) is that it can spit out CMakeLists.txt and compile_commands.json for IDE/LSP integration and also supports installing Conan/vcpkg libraries or even Git repos.

set_project("myapp")
set_languages("c++20")

add_requires("conan::fmt/11.0.2", {alias = "fmt"})
add_requires("vcpkg::fmt", {alias = "fmt"})
add_requires("git://github.com/fmtlib/fmt v11.0.2", {alias = "fmt"})

target("myapp")
set_kind("binary")
add_files("src/*.cpp")
add_packages("fmt")


Then you use it like

# Generate compile_commands.json and CMakeLists.txt
$ xmake project -k compile_commands
$ xmake project -k cmake

# Build + run
$ xmake && xmake run myapp

Agreed, xmake seems very well-thought-out, and supports the most modern use-cases (C++20 named modules, header unit modules, and `import std`, which CMake still has a lot of ceremony around). I should switch to it.