What brought you to Meson, why not CMake?

The truth is that I have been using CMake for a while. When I am working for some business, CMake is still my first choice, for a pragmatic reason: if we have to use Linux + Mac + Windows and my workmates use IDEs, the project generation is still better in CMake. CMake has an impressive project generation story: from XCode to Visual Studio to Ninja, Make and others. This is something that helps me avoid frustrating my workmates.

After using CMake for a while, I became frustrated with a few things:

the scripting language is terrible inconsistencies in the design that make the learning curve difficult, especially for other people that come to it documentation leaves a lot to be desired precompiled headers? good luck cross compilation

Point 1 has had endless discussions. CMake syntax problem is more serious than it could look at first: it has taken me forever (and I still do not get it right) how to manage conditionals correctly, variable interpolation can expand to nothing at the slightest typo. Yes, I know that Modern CMake is better, but still, you have to be quite careful. In Meson variables have a type, such as in Python. Meson DSL is quite similar to Python, but not the same exactly. This can catch a lot of these frustrations before you generate your project build.

As for point 2 you have all this Modern CMake in which the target_* oriented features should be used, but all globals still exist. Meson gets this right since the beginning.

Point 3: this is one of the most important points for me: documentation in CMake is manual-oriented, without examples. Meson documentation kicks the ass of CMake documentation and it saved plenty, I mean *plenty* of time for me. It has a good reference, a sane syntax that I can parse and enough examples to get started. This combined with a sane scripting language and a consistent design, at the end, were the deciding factors to adopt it over all the other tools, including CMake.

Point 4: no need to explain this one. This is really difficult to get right actually, more than it looks and Meson supports it out of the box.

Point 5: this could be subjective, but I had such a bad time trying to cross compile with CMake that when I did it with Meson it just looked so natural and better well thought. Though I cannot make an extensive assessment about this point.

What does Meson offer over CMake that is worth the change, besides what I mention above? Meson includes by default: targets support for sanitizers, unity builds, precompiled headers support out of the box, valgrind support, ccache autodetection, a saner way to manage options (which can be typed or restricted without additional parsing) and virtually every day to day use that you have to do of it is more consistent and makes you waste less time, something that, after my CMake experience, should not be underestimated. It also has some natural hooks for preconfiguration, postinstall and other common needs that are quite handy, without messing too much with custom solutions. It also supports many common needs such as the use of Boost, Qt5, WxWidgets and others out of the box. It is also extremely fast and well optimized.

Many projects are adopting Meson lately, especially those that come from the unix world, such as systemd, Xorg and some Gnome projects. I am pretty sure at this point that Meson is going to become, as a minimum, the standard build system for non-Windows platforms. You can see a list here. Other projects such as nlohmann json provide also meson support.