r/cpp • • Jul 21 '22

CMake is a hell of a software, period.

Really CMake is good only for one thing being the sacred build generator system in the c/cpp world.

F*** the weird syntax and werid structures.

edit 1: some might argue it's the best avaiable solution to the problem domain, and it is. the problem is the syntax, the unintiutive way of specifiying option and simple compile parameters and options and lack of examples and resources on how to do the simplist things is a wasting too much time.

yeah modern cmake that encourge using targets and their properties is by far a lot better but still is extremely unintuitve due to the syntax and logic around it.

sorry for the typos.

edit 2:

i am really considering changing my main language for personal projects to rust or the new thing called carbon by google at least there is not a hell of backward compatibility garbage i need to know.

358 Upvotes

319 comments sorted by

View all comments

Show parent comments

7

u/nysra Jul 21 '22

It's not even close to being the best. Everyone knows it's terrible, but it's still the de-facto standard.

0

u/tristan957 Jul 21 '22

No it's not. Meson is a hefty competitor that can easily interoperate with CMake.

5

u/nysra Jul 21 '22

I'm aware of how great Meson is and I'd very much see CMake die already but unfortunately CMake is basically everywhere at the moment. If you take a look at surveys like the recent ISO C++ 2022 survey then nothing comes even close to CMake so calling it the current de-facto standard seems approriate, even if it's a bad one.

2

u/germandiago Jul 24 '22

I do not think this is currently a problem for you to use Meson except for the project generator in Vs and Xcode if you use it.

I tell u why: you can generate .cmake files anyway for others to consume your project, the build tool is way easier, Meson can still consume CMake projects and it does have even a subproject model with Meson wraps, makes easy to cross compile and the syntax is better. If you need a bunch of packages, many of them to be ready consumable, the most reasonable thing is that you end up using Conan anyway, and it also plays well with Meson.

So I would recommend you to use Meson unless you need the project generators. Also, I will take a look at how mature it is compared to last time VS and XCode. Did not try for the last 3 years almost.

2

u/nysra Jul 24 '22

You don't need me to convince to use Meson, already using it for everything ;P

This is strictly about the terminology. Even if we don't like it the fact is that CMake is used a lot more than any other build system currently, therefore it's the "de-facto standard". The sooner we get rid of it occupying that position the better of course. I'm not saying people should use CMake (on the contrary, please use a better system like Meson), I was just pointing out that currently it's widespread. The comment chain is basically

Original: CMake is the best build system

Me: No it's not. It's just the most common one

Tristan: It's not the most common one

Me: Yes it is (see survey). It's shit, but it's common.

using Conan anyway, and it also plays well with Meson.

Personally I prefer vcpkg, getting that to work with Meson is as simple as setting the pkg config path once. Well at least as long as you use vcpkg's global mode, I'm sure there's a way to make it play nice with manifest mode too but I'm in the fortunate position of not needing different versions of a library so I didn't have to bother figuring that out yet. Glad to hear that Conan works well with Meson too though, the more tooling integration Meson gets the better.

2

u/germandiago Jul 24 '22

I see. :)

You see much of CMake is the best because people invest time in learning tools, later they do not want to get away. So the argument starts to get a bit emotional for many of us I guess. I still use CMake at work, and it is true it works, but when you have to start to code logic in that DSL, it is really awful. Also, the dependency management... well, it can get complicated. In Meson those two are a no-brainer and they drained enough of my time before so that I decided to switch. And I tried before Meson: SCons, Waf, Tup and others. Long ago I used to use Autotools, but that is way back.

2

u/nysra Jul 25 '22

People get a little bit too invested into tools sometimes, yes. On one hand I can understand it, it's only natural. But on the other hand we're not talking about an C++ sized language, it's just a build tool and changing that is not a lot of effort (well depending on how badly written your previous build files were it can get ugly).

I still use CMake at work, and it is true it works, but when you have to start to code logic in that DSL, it is really awful.

Even for basic stuff CMake is just ugly. Sure it works and it's not complicated either but it just doesn't look right. The only thing it got going for it is the momentum.

And yeah working with dependencies in Meson is much nicer, plus the standardized layout (subprojects) helps when looking at other repos.