30 ms·
2019 was the last time I looked into the CMake vs. Meson debate and while Meson looked 100% saner, cleaner, etc. the network effects of most of the popular C++
by lazypenguin 4y ago
2019 was the last time I looked into the CMake vs. Meson debate and while Meson looked 100% saner, cleaner, etc. the network effects of most of the popular C++ libraries using CMake made me end up picking CMake. I'd be curious how the landscape is today but I now have stockholm syndrome with CMake especially using vcpkg.
- einpoklum 4y agoI looked at these two, not just 2019 and meson looked much more difficult to use, and super-confusing, to the person who needs to perform the build. In terms of writing CMake vs Meson - I've only written CMake, but I've tried to look into meson files to understand how to tweak something, and it was hard for me.
- loup-vaillant 4y agoI happen to have had the more neutral perspective of being a beginner at both. Meson was easier to pick up. Not nearly as easy as I feel it should be (the idea of a meta build system when you target a single platform has always struck me as insane), but still easier than CMake.
- tristan957 4y agoCMake is also a meta build system, so I don't understand your point. Meson targets many platforms, some better than others. * Visual Studio Projects * Ninja * XCode
- MBCook 4y agoNot the GP but I read their point not as pro-Meson but more that both Meson and CMake feel like overkill for a single platform/architecture project.
- tristan957 4y agoIf you are the only contributor, targeting one compiler, on one platform, then yep, I could see how this might be overkill.
- jcelerier 4y ago> (the idea of a meta build system when you target a single platform has always struck me as insane) who targets a single platform in 2022 ? I have honestly never in my professional life worked on non-embedded C++ projects that only targeted one platform (and honestly, even those had to run on host computers with people developing from any host OS, Mac / Win / Linux) ; on the other hand I had a lot of time people ask me to have support for working on the project from either Xcode, Visual Studio or others IDE. How do you do that without a meta-build system?
- maccard 4y agoLots of places who develop desktop software will develop only on that platform for that target. It might be easier to just maintain a visual studio solution if you're only targeting windows and developing on windows. Early in my career, I worked on a project that built for 4 platforms, not all x64, and was managed through msbuild, i.e. it just worked in visual studio.
- loup-vaillant 4y ago> who targets a single platform in 2022 ? Me, in the last 3 jobs I worked on. In fact, the majority of my career targets a single platform. I believe it's common for applications to target only one platform. Even when Windows is the first such platform. Heck, I've even read some advice about re-writing your application instead of trying to make it multi-platform. Libraries are different, though. And that application you plan to rewrite 3-6 times should probably offload the entire business logic to a truly multi-platform library. So I guess meta-build systems could possibly make some sense there. Still, what I've seen in practice is an extremely shallow layer of non-abstraction that just hides what actual commands happen under the hood. I know how to call a compiler on the command line, I know its inputs and output, and I can reuse this knowledge when I write a Makefile. CMake, not so much. > on the other hand I had a lot of time people ask me to have support for working on the project from either Xcode, Visual Studio or others IDE. How do you do that without a meta-build system? My feeling is that it's not the job of the (meta) build system to support the idiosyncrasies of the latest IDE (or editor) of the day. It's the job of the IDE to provide what users need to call the right build command for the right situation (build debug, build release, clean…). And for fancy stuff like auto-completion and jump to definition, the IDE should provide the necessary magic independently of the actual build system used. If this independence between the build system and the IDE cannot be achieved, then maybe the language is the problem. I know, people are doing real work and have no time for long term plans. Just, the absence of a short term solution doesn't mean there is no problem.
- tristan957 4y agoMeson integrates fairly well with CMake. The CMake support is maintained by a student however. Said student has been busy for a bit, so some bug reports and feature requests have sat dormant. My needs are 100% met. A ton of popular C++ libraries exist within Meson's WrapDB however.
- plorkyeran 4y agoMy experience with trying to use Mseon's CMake integration is that it works just well enough to trick you into thinking that it's a good idea to use, but not well enough to make it actually a good idea.
- bogwog 4y agoYeah I don't see the value proposition of Meson to be all that compelling. It's basically just CMake, but with a different DSL. I've never had a problem with modern CMake, and whatever minor productivity benefits there might be from Meson are far outweighed by the popularity of CMake. Even if Meson is more "powerful", there are other build systems out there that are better options than either of these.
- tristan957 4y agoPerhaps you shed some light on what the better build systems are? Meson is much more than just a different DSL. What is the CMake standard option for toggling between library types? What is the CMake standard option for toggling lto? What is the CMake standard option for enabling sanitizers? Meson standardizes so much behavior. I can go to any project and immediately be able to configure a build with the parameters that I want.
- IAmLiterallyAB 4y agoDon't know about the others but for LTO on CMake there is https://cmake.org/cmake/help/latest/prop_tgt/INTERPROCEDURAL_OPTIMIZATION.html https://cmake.org/cmake/help/latest/prop_tgt/INTERPROCEDURAL...
- slavik81 4y ago> What is the CMake standard option for toggling between library types? -DBUILD_SHARED_LIBS=<ON,OFF> > What is the CMake standard option for toggling lto? -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=<ON,OFF> > What is the CMake standard option for enabling sanitizers? There isn't one, sadly. Though, you can set CXXFLAGS to configure whatever behaviour you want.
- bogwog 4y ago> Perhaps you shed some light on what the better build systems are? To clarify, I mean "better" for complex tasks. Build systems are just tools like any other, meaning they're good at some things, but bad at others. CMake (and Meson) are good for simpler build scenarios, but when you need complexity they're a poor choice. For that you're better off with scons, waf, bazel, ant, buck, gradle, etc. > Meson is much more than just a different DSL. What is the CMake standard option for toggling between library types? What is the CMake standard option for toggling lto? What is the CMake standard option for enabling sanitizers? > Meson standardizes so much behavior. I can go to any project and immediately be able to configure a build with the parameters that I want. Again, my issue with Meson is that it doesn't bring anything substantially new to the table to justify it. Having a nicer DSL isn't enough, and having some built in toggles for common things isn't enough. The fact that you happen to be more comfortable with Meson doesn't make it objectively better than CMake. Figuring out how to enable LTO and sanitizers for a CMake project might take a few minutes of Googling at most. A new dev who has never encountered either of these might instinctively prefer Meson's syntax, but the wiser decision is to learn the (vastly) more mature and prolific CMake, and then not have to worry about it. Time spent on the build system is time not spent on the project.
- stefan_ 4y agoI don't understand, how does the popularity of CMake benefit you when using it as a build system? Because from my experience, they have gone out of their way to break any sort of network effects. Most recently they added the whole "wholly new target based CMake" stuff and now the entire ecosystem is split into two and declaring any CMake version except the exact one you are using as compatible a full crap shoot. That's strike 2 after never integrating with pkgconfig and instead having you write shitty FindFoo files for everything.
- slavik81 4y ago> they have gone out of their way to break any sort of network effects. Most recently they added the whole "wholly new target based CMake" stuff That was in 2014. If that was their most recent screw-up, they're doing pretty good. > That's strike 2 after never integrating with pkgconfig and instead having you write shitty FindFoo files for everything. There is pkgconfig integration [1], though most libraries autogenerate CMake config files these days. [1]: https://cmake.org/cmake/help/latest/module/FindPkgConfig.html https://cmake.org/cmake/help/latest/module/FindPkgConfig.htm...
- stefan_ 4y agoIt started in 2014 - it's ongoing today, it's a joke. Yes, of course there is some magic macro, but I already declared the dependency, please just find it, I'm not here to put boilerplate into Find scripts.