r/cpp • • Oct 06 '26

University of Waterloo user study on understanding CMake changes

Hi everyone,

I’m Mattie Nejati, a Ph.D. candidate at the University of Waterloo. I’m conducting a user study on understanding the impact of changes to CMake build specifications, and I’d love to invite members of this community to participate.

We are evaluating a new approach that aims to help developers identify how a change to a CMake build specification affects the resulting build configuration.

The study:

  • is conducted entirely online;
  • takes about one hour;
  • involves inspecting changes to CMake build specifications and identifying their impact; and
  • is open to adults aged 18–64 with any level of experience in CMake, programming, or code review.

You do not need to be a CMake expert. We are specifically interested in comparing participants with different levels of experience.

You will need a computer with internet access and about 4 GB of free space to download the files required for the tasks.

We will not collect your name. Your email address will only be used for study follow-up and will be stored separately from your study data. Your name or email will not appear in any dataset or publication.

The study has received clearance from the University of Waterloo Research Ethics Board (REB #46621).

If you’re interested, you can find the consent form, screening questionnaire, and study here:

https://buiscout.cs.uwaterloo.ca/

Thank you very much! And if you know someone else who works with CMake who might be interested, I’d really appreciate you sharing the study with them.

56 Upvotes

59 comments sorted by

View all comments

120

u/garnet420 Oct 06 '26

Finally, someone will prove scientifically that cmake is garbage

13

u/NegativeProduct1705 Oct 06 '26

Can you explain why it's garbage?

34

u/garnet420 Oct 06 '26

Besides the fact that it decided to keep make's general aesthetic (bad but arguably this is subjective) here are three reasons:

  1. There are too many ways to do a single thing with nothing driving deprecation or idiomatic use as far as I know.
  2. Configuration is a mess of badly named variables, with projects adding their own on top of that. The general expectation is that you configure stuff on the command line, with config files being an afterthought.
  3. Environment variables have no place in a build system. Environment variables are shit.
  4. No design for hermeticity or reproducibility. This is probably the biggest one.

Now, full disclosure, I'm a bazel user; before that, I used gn, and before that, make.

5

u/drbazza Oct 07 '26

Besides the fact that it decided to keep make's general aesthetic

I'm genuinely curious - are you aware of CMake's history?

1

u/garnet420 Oct 07 '26

No, why

5

u/drbazza Oct 07 '26

Well, for one, make was the only show in town on Unix, and then there was VS.

CMake was developed to support building the Insight Segmentation and Registration Toolkit (ITK) for multiple platforms. Stated goals included addressing weaknesses while maintaining strengths of contemporary tools such as autoconf and libtool, and to align with state of the art build technology of the time: configure scripts and Make files for Unix platforms, and Visual Studio project files for Windows.[6][4]

https://en.wikipedia.org/wiki/CMake

Some cmake employees are active on this subreddit and can probably correct me if I'm wrong, but to put it another way, it is a build system generator where you write a generic build script and it generates make or .vcproj files (and now, ninja).

Ironically, it probably can produce bazel BUILD files and so on, if someone wanted to put in the work.

Of course you can also read 'Build Systems a la Carte' paper that scientifically describes what a build system is, and then you realise the tension between programmatic (make) and declarative (vcproj XML files) has to meet in the middle. Which is real-world reasons for your points.

https://simon.peytonjones.org/assets/pdfs/build-systems-jfp.pdf

6

u/garnet420 Oct 07 '26

I'll give those a read sometime

But the make syntax thing isn't about some high level declarative versus programmatic principle.

It's about basic developer ergonomics. A giant, flat namespace of variables is just terrible.

The information expressed in the build system should be compartmentalized and hierarchical.

1

u/archialone Oct 06 '26

I agree, I am a Bazel user too, I don't think I can go back to CMake after bazel

0

u/13steinj Oct 06 '26

Everything you listed is more or less a problem of every build system. I don't even know how you'd drive Bazel with config files, but that just isn't true of cmake. -C and the presers format exist for that purpose.

Bazel doesn't design for hermeticity / reproducibility. The defaults are unsandboxed, and it's incredibly easy to break hermiticity rules in nasty ways. I can concede that if you're starting from scratch it holds your hand much better, whereas cmake is much more trial by fire no matter how complex your project is, and if your build is hermetic it is nice to have a compilation distributor client built in.

Full disclosure: I manage more or less my entire company's build, for my current and past two jobs. The first had really, really bad cmake (and I had limited mobility to push the needle). The second had great cmake. The current one is at the end of it's transition to Bazel.

If it was up to me I'd still choose cmake today. I've had to open Bazel in gdb one too many times to still drink the koolaid.

8

u/tarranoth Oct 06 '26

Yes, but as far as I know there's no real cmake linter you can really run yourself telling you that there's outdated design in your project. And every couple of years they seem to change what is current cmake best practices like last I checked now it's using FILE_SET with target_sources and forgoing target_include_directories, something I only learned randomly by scrolling reddit last year from this post: https://www.reddit.com/r/cpp/comments/1mjw02w/i_wrote_a_comprehensive_guide_to_modern_cmake/n7f1u4e/.

Imo problem is that build systems are basically expressive languages with 0 guidance, in a normal programming language people create all kinds of linters/static analysis and run it on every change you commit, but that effort has never been given to build systems, with all the consequences we can see in current times where nobody understands what to actually do with these arcane systems. Doesn't help that apparently all the good Cmake explanations are behind paywalled books everytime someone asks for good cmake guidance.

-2

u/13steinj Oct 06 '26

There is a cmake linter last I checked? But it's someone's pet project.

From a linting standpoint this will sound like I'm LLM pilled but the docs are very good, just have it generate a simple linter based off that and aggressively set policies to NEW.

1

u/garnet420 Oct 06 '26

I would call most of the files in bazel config files. Plus .bazelrc. The point is that your options are part of your repo, not just crap people throw on a command line.

3

u/13steinj Oct 06 '26

Sure, the same is true of cmake? If you're thinking of .bazelrc modern equivalent is CMakePresets.json but historically you can (and should in general) use cmake -C somecachefile where somecachefile is a limited subset of cmake used to prepopulate the cache (mostly set and if).

1

u/garnet420 Oct 06 '26

Possibly I've only experienced other people's bad cmake.

1

u/wjrasmussen Oct 06 '26

it is basically the stem epenis measuring contest.

6

u/somewhataccurate Oct 06 '26

No its a perfectly simple and understandable tool /s

5

u/drbazza Oct 07 '26

To paraphrase Churchill, CMake is the worst of all build systems, except for all the others.

1

u/garnet420 Oct 07 '26

I kind of wish scons was better, i liked its overall idea.

2

u/RevRagnarok Oct 07 '26

Stable release 4.11.1 / August 27, 2026; 41 days ago

Huh; I had assumed it was long dead. I thought it had some great ideas too back in the day...