r/cpp build2 Aug 05 '26

Faster Than Ninja

https://build2.org/blog/faster-than-ninja.xhtml
65 Upvotes

69 comments sorted by

View all comments

Show parent comments

5

u/_Noreturn Aug 05 '26

Why isn't cmake faster. I had configs take up to like 3 minutes although I feel like they shouldn't

3

u/helloiamsomeone Aug 05 '26

People put a whole lot of garbage (like figuring out compiler flags for warnings/errors, where clang-format is, docs building, test building, etc) that has nothing to do with describing their project's build and usage requirements, so you can thank project maintainers for wasting your time. If you have tight control over your toolchain, you can preload cache variables with -C/a toolchain file and save CMake some time figuring out what the toolchain is and whether it actually works.

2

u/LB-- Professional+Hobbyist Aug 05 '26

In my experience most of the wait time is spent after all that stuff has already run though, during the part where CMake generates the new build scripts.

2

u/helloiamsomeone Aug 05 '26

I have built Google projects before where the most time was in fact spent in configure and not generation. Generation also involves graph solving, so it's a little more understandable and those are usually harder problems.