4 ms·
Slightly off topic (but part of the build instructions), but why do people like CMake? I have an aversion to learning it because it seems like an abstraction o
by bdhdkldbgdhvvdd 5y ago
Slightly off topic (but part of the build instructions), but why do people like CMake?
I have an aversion to learning it because it seems like an abstraction of an abstraction and of little value. But I’d like to change my mind.
(Thanks for this btw, I was looking for something like this)
- junon 5y agoCMake sucks in a lot of ways but it's the only build system that is mainstream right now that doesn't impose some philosophical idealisms as to how your code should work. Meson is the next runner up and it should come with a religious text about how the creator thinks software should work.
- juanbyrge 5y agoI think the primary use case is building the same code on multiple platforms. A developer can write a single CMakeFile and then CMake will generate Makefiles/Ninja files/VS soln files/etc depending on the underlying platform.
- MiddleMan5 5y agoI've used CMake for a number of larger projects. When you start having to deal with external dependencies or cross platform support it definitely fills in some of the holes in the C-style build ecosystems One of the things I've never been a fan of is that for whatever reason, the build steps that you see in basically every project are: - mkdir ./build - cd ./build - cmake configure ../ - make build Has no one thought of simplifying that??
- pjmlp 5y agoYes, we write a shell script and move on.
- jcelerier 5y agohttps://github.com/jcelerier/cninja https://github.com/jcelerier/cninja
- AHTERIX5000 5y agoYou can simplify it to cmake -B build && make -C build for example
- 1vuio0pswjnm7 5y agoSeems like it usually comes in when people try to support building on Windows. Not sure people "like" it, but they claim it makes the job easier. Sometimes cmake is optional. That is, one can still type "make" on Linux/BSD and just ignore the cmake files. Unfortunately, that seems to be the less common way to use cmake. Using cmake on Linux/BSD does seem like overkill. It is not necessary. I share the aversion to learning cmake but always figured complaining about it would not be well-received.
- bogwog 5y agoCMake isn’t that bad. The language gets a bad reputation, but there’s honestly not that much to hate about it. Maybe if you’re maintaining thousands of CMake files, then yeah it can probably become a pain. But for most cases it just does what you need it to, and reliably. The “killer” feature is that it can generate Visual Studio solutions, which is a big deal for some projects, and a great asset for cross platform development. Now what I don’t get is why Meson is so popular. I haven’t dived into it, but from the outside it doesn’t look like all that different from CMake. Seems to me like the vast majority of Meson projects would be better off with CMake just because it’s more mature and well known, but otherwise does the exact same thing.
- darknavi 5y agoI like it simply because C/C++ does not have a standard package manager/build system.
- deleted 5y ago[deleted]
- DyslexicAtheist 5y agoone thing I'll never stop struggling with isn't cmake but the interaction of it from within the editor. vim-cmake is cool but not always easy to set-up on legacy projects where the build-system has even more technical debt than the code itself. I can't really blame cmake for this though.
- jcelerier 5y agoFor the task of building there aren't many cross-platform abstractions which : - is easily boostrappable - works on OS without any kind of POSIX shell - allow to extract, download, create file / directories in a cross-platform way (cmake extracts 7z, zip, .tar.gz and friends on every platform with a single command) - allow to quickly parse and generate code with regexps without having to fight with whatever difference between versions of perl, rename, etc. there are on the host system - does not require "quoting" every flag or source file (seriously, this is just a pain in most more recent BS) - just works with everything that can be thrown at it and accommodates the project's way of handling dependencies instead of trying to impose its own - easily allows to find dependencies on systems with no canonical path to look for them
- sirwhinesalot 5y agoI don't think anyone likes it much, but it's the closest thing to a standardized project / build system thingy in C/C++ land. It has the best IDE support for example.
- dezgeg 5y agoCMake: The Good Parts (with apologies to PHP: The Good Parts https://twitter.com/tomnomnom/status/195304317601849344 https://twitter.com/tomnomnom/status/195304317601849344) 1. It's widely available (even on Windows). 2. It's not as bad as autotools.
- jjgreen 5y agoYou were right the first time: https://twitter.com/cmakehate https://twitter.com/cmakehate
- krapp 5y agoIn my case, I use Cmake because it's easier to link libraries in a Visual Studio project through CMake that way than through VS itself.