Live data from Hacker News

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

github.com

41–50 of 181 posts

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

#42
post #4

FWIW: there is something fundamentally wrong with a meta-meta build system. I don't think you should bother generating or wrapping CMake, you should be replacing it.

Another fresh example of what you don't like: https://www.youtube.com/watch?v=ExSlx0vBMXo Building C++: It Doesn't Have to be Painful! - Nicole Mazzuca - Meeting C++ 2025

Build systems don't plan to converge in the future =)

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

#43

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", {alia…

I would happily switch to it in a heartbeat if it was a lot more well-documented and if it supported even half of what CMake does.

As an example of what I mean, say I want to link to the FMOD library (or any library I legally can't redistribute as an SDK). Or I want to enable automatic detection on Windows where I know the library/SDK is an installer package. My solution, in CMake, is to just ask the registry. In XMake I still can't figure out how to pull this off. I know that's pretty niche, but still.

The documentation gap is the biggest hurtle. A lot of the functions/ways of doing things are poorly documented, if they are at all. Including a CMake library that isn't in any of the package managers for example. It also has some weird quirks: automatic/magic scoping (which is NOT a bonus) along with a hack "import" function instead of using native require.

All of this said, it does work well when it does work. Especially with modules.

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

#44
post #37

Earlier quoted context omitted.

Do your Makefiles work across Linux, macOS and Windows (without WSL or MingW), GCC, Clang and MSVC, or allow loading the project into an IDE like Xcode or Visual Studio though? That's why meta-build-systems like cmake were created, not to be a better GNU Make.

There is something fundamentally wrong with Windows or Visual Studio that it requires ugly solutions.

Windows and Visual Studio solutions are perfectly fine. MSBuild is a declarative build syntax in XML, it's not very different from a makefile.

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

#45
post #36

If you think cmake isn't very good, the solution isn't to add more layers of crap around cmake, but to replace it. Cmake itself exists because a lot of humans haven't bothered to read the gnu make manual, and added more cruft to manage this. Please don't add to this problem. It's a disease

I'm all for shitting on CMake, but Jesus, to suggest Make as a replacement/improvement is an unhinged take.

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

#46
Besides Cargo, you might want to take a look at Python's pyproject.toml standard. https://packaging.python.org/en/latest/guides/writing-pyproj...

It's similar, but designed for an existing ecosystem. Cargo is designed for `cargo`, obviously.

But `pyproject.toml` is designed for the existing tools to all eventually adopt. (As well as new tools, of course.)

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

#47
post #16
post #12

Earlier quoted context omitted.

[flagged]

If you'd just left off "to fuck" you'd end up way less downvoted, if it even happened at all.

With fucks, without fucks, in iambic pentameter, anything vaguely critical of Rust will be downvoted. As you can see.

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

#48
In the age of AI tools like this are pointless. Especially new ones, given existence of make, cmake, premake and a bunch of others.

C++ build system, at the core, boils down to calling gcc foo.c -o foo.obj / link foo.obj foo.exe (please forgive if I got they syntax wrong).

Sure, you have more .c files, and you pass some flags but that's the core.

I've recently started a new C++ program from scratch.

What build system did I write?

I didn't. I told Claude:

"Write a bun typescript script build.ts that compiles the .cpp files with cl and creates foo.exe. Create release and debug builds, trigger release build with -release cmd-line flag".

And it did it in minutes and it worked. And I can expand it with similar instructions. I can ask for release build with all the sanitize flags and claude will add it.

The particulars don't matter. I could have asked for a makefile, or cmake file or ninja or a script written in python or in ruby or in Go or in rust. I just like using bun for scripting.

The point is that in the past I tried to learn cmake and good lord, it's days spent learning something that I'll spent 1 hr using.

It just doesn't make sense to learn any of those tools given that claude can give me working any build system in minutes.

It makes even less sense to create new build tools. Even if you create the most amazing tool, I would still choose spending a minute asking claude than spending days learning arbitrary syntax of a new tool.

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

#49
Feedback of someone who is used to manage large (>1500) software stack in C / C++ / Fortran / Python / Rust / etc:

- (1) Provide a way to compile without internet access and specify the associated dependencies path manually. This is absolutely critical.

Most 'serious' multi-language package managers and integration systems are building in a sandbox without internet access for security reasons and reproducibility reasons.

If your build system does not allow to build offline and with manually specified dependencies, you will make life of integrators and package managers miserable and they will avoid your project.

(2) Never ever build in '-03 -march=native' by default. This is always a red flag and a sign of immaturity. People expect code to be portable and shippable.

Good default options should be CMake equivalent of "RelWithDebInfo" (meaning: -O2 -g -DNDEBUG ).

-O3 can be argued. -march=native is always always a mistake.

- (3) Allow your build tool to be built by an other build tool (e.g CMake).

Anybody caring about reproducibility will want to start from sources, not from a pre-compiled binary. This also matter for cross compilation.

- (4) Please offer a compatibility with pkg-config (https://en.wikipedia.org/wiki/Pkg-config) and if possible CPS (https://cps-org.github.io/cps/overview.html) for both consumption and generation.

They are what will allow interoperability between your system and other build systems.

- (5) last but not least: Consider seriously the cross-compilation use case.

It is common in the world of embedded systems to cross compile. Any build system that does not support cross-compilation will be de facto banned from the embedded domain.

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

#50
post #37

Earlier quoted context omitted.

There is something fundamentally wrong with Windows or Visual Studio that it requires ugly solutions.

Windows and Visual Studio solutions are perfectly fine. MSBuild is a declarative build syntax in XML, it's not very different from a makefile.

XML is already terrible. But the main problem seems to be that they created something similar but incompatible to make.
Post reply on HN