3 ms·
I don't get the hate for CMake. It has several useful advantages over plain makefiles: * It's meant to be cross-platform, so a well structured CMake file will
by AlexandrB 8y ago
I don't get the hate for CMake. It has several useful advantages over plain makefiles:
* It's meant to be cross-platform, so a well structured CMake file will work in Windows.
* CMake modules allow you to include source-based libraries without a lot of drama. This is especially useful for cross-compiling or embedded use-cases.
* Out-of-source builds are supported with no additional work on my part. This is great for CI generating debug, release, and other build variants from a single cloned repository.
- asveikau 8y ago> It's meant to be cross-platform, so a well structured CMake file will work in Windows. A well structured more conventional makefile can also run on Windows. The tree I'm working on builds for Unix and Windows with the same makefile. (No cygwin or WSL either, just GNU make running on Win32. A few ifdefs and strategically placed variables.)
- codeflo 8y agoOn Windows, do you edit and debug your code in Visual Studio, or some other editor and just use the MSVC command line tools for building? Because one of the (very few) things I actually like about CMake is that it produces project files that Visual Studio can open directly.
- asveikau 8y agoI debug with windbg on Windows. I like it much more than the VS debugger. Habits I picked up from when I worked at MS.
- klodolph 8y agoComparing anything against plain Makefiles is a really low bar. Makefiles have been around since 1976. I think the hate for CMake comes from other directions entirely. The CMake scripting language is especially bad. Out-of-source builds were never really that hard in the first place. I think people hate CMake either because they were doing something slightly more unusual than CMake tolerated, or because they hated CMake's language (which is very easy to hate). CMake has simply sucked less, overall, than the competitors of its time, for most common build tasks. That era is over, now that the new generation of build systems is here (Bazel, Buck, Pants, Please).
- codeflo 8y agoI wonder how Makefiles got such a bad reputation. After decades of reading how bad Makefiles are, I recently tried writing one for a moderately complex build, just for fun. I was pleasantly surprised: make is very fast, it's well-documented, and the execution model is so simple that I found it very easy to figure out how to script the things I needed to do. I'm not saying it's great, but there are a lot worse build systems around that people still actively advocate (cough msbuild).
- int_19h 8y agoHow about significant whitespace with a difference between tabs and spaces, for starters?
- klodolph 8y agoOver the past 30 years or so, build tools for C and C++ programs have converged to what you see today. For example, with GCC you can use the -M options, and then you can -include the result in your makefile. This was not always possible. You had to manually specify the .h files for every .c, and if you omitted one, you could get a successful build but a broken program! Then consider the process of building a shared library, which is different on different platforms, but if you restrict yourself to GCC on Linux with GNU Binutils it’s damn easy. There are a few other, minor failings of Make. But you’re right, it’s very comprehensible and straightforward. I still say that it’s a low bar, though, by modern standards.
- naavis 8y agoYes, CMake let's you do great things, but holy moly is writing CMake files painful.
- 01100011 8y ago* Poorly designed DSL. * "Everyone" knows GNU make. The lead at my old job was obsessed with CMake. It was an improvement over Boost.Build(barf..), and to the degree it replaces something like autotools I'm all for it, but it was yet another DSL in a company filled with DSLs. It took us 3 months to get new devs up to speed because of all the shit they had to learn. I can take a sw dev(embedded sw, because that was the role) off the street and there's a 90% chance they're conversant in GNU make. About 90% have no idea how to write a CMake file. When I looked at the CMake files, I noticed source and target rules were spread out over the file, which seemed like a really bad idea to me.