12 ms·
CMake Announcement from Boost Steering Committee
- quotemstr 9y agoCMake is a big improvement, but it's a shame they didn't opt for Buck or Bazel. These two build systems are as much an improvement over the previous generation as autoconf and GNU Make were improvements over random ad-hoc configure scripts. Both take pains to ensure that builds are fully hermetic and fully reproducible, support rich introspection, and run very, very fast.
- aristidb 9y agoTrue, but Cmake has a lot of users already familiar with it and who have it pre-installed. So I applaud this change to use Cmake!
- ungzd 9y agoIt looks like few people are familiar with CMake, others are just copy-pasting snippets of configuration code from googled results. And noone knows how to do it right. The same is with Autotools.
- SXX 9y agoEven if you look at Kitware own products they full of quite outdated and ugly code. I think it's because amount of code and platform-specific hacks in CMake / CPack / CTest is just too hard to maintain and many things will break hard while there was no changes in them for years. Also copy-pasting sometimes work better simply because very few developers actually able to check how their own configuration work across multiple platforms and endless number of Linux distributions. It's might look easy to make your own configuration, but once you try to at least cover Windows, Mac and Deb-based Linux it's take weeks to debug everything. Instead you can copy-paste someone else module, change few lines and it's will already cover everything you need. EDIT: typo: on -> once
- deleted 9y ago[deleted]
- deleted 9y ago[deleted]
- petters 9y agoBut Cmake has support for IDEs like Visual Studio. That is a huge benefit compared to Bazel.
- netheril96 9y agoNeither Buck nor Bazel have mature support for Windows. And I very much dislike them for the enormous amount of dependency.
- oneplane 9y agoBut unless you are confined to Windows, that doesn't really matter, does it? Most code for Windows seems to be written using Microsoft's own tools as far as I know, which makes both the people asking for FOSS tools and the people that make FOSS tools to begin with less likely to target Windows.
- tonyarkles 9y agoThe beauty of CMake, for me, is that it can generate both Makefiles and VS2015 files. An example that I've posted here before about was a userland USB driver backed by libusb. I wrote it in idiomatic C++11 (or C++14, don't remember exactly), and amazingly I was able to generate a .so, a .dyld, and a .dll from the same source code, without needing a single #ifdef. Built using gcc on Linux, clang on OSX, and VS2015 on Windows. CMake would output Makefiles on the first two, and a VS solution file on Windows that I could build. I'm still amazed by it a couple years later.
- mwfunk 9y agoThat's a pretty ginormous "but unless...". It would not surprise me if more people are building and using Boost than all other platforms put together. I haven't done any Windows development in 10+ years, but it's not like everyone else stopped when I did.
- vinkelhake 9y agoWe're in the context of Boost here and it has great support for Windows. Switching to a build system that doesn't have mature support for Windows is simply a non-starter for the Boost project. That a lot of FOSS projects (understandably) have poor support for Windows doesn't mean that all of them do. It also doesn't mean there isn't demand for FOSS projects on that platform.
- 9y ago
- 0xFFC 9y agoI completely disagree. Other companies do provide excellent support for CMake right now. Take for example android new cmake toolchain support for compiling for android. Compiling your project for Android is as easy as adding a command line parameter. Neither Buck and Bazel are nowhere near as Cmake. As someone who works with C++ and cross compiles code to arm. I really appreciate and enjoyed with recent trends in porting codes to cmake build(prebuild?) system .
- ungzd 9y agoBuck and Bazel are definitely far better designed than these scary piles of macros like CMake and Autotools, but far from being ready for the same use cases. These new tools are designed for Google and Facebook's specific use cases: building binaries to run on their own servers, or mobile apps, from sources in monorepos (with dependencies copied to repo![1]). I think even building packages for Linux distros is hard with these systems and cross compilation is barely documented too (however seems that it is supported, even for Windows). There are no discovery of libraries installed in system and features of system (killer feature of autotools). [1] https://buckbuild.com/command/fetch.html https://buckbuild.com/command/fetch.html
- corndoge 9y agoOr meson, which gnome and systemd now support, among other big projects.
- moosingin3space 9y agoWhile bazel and buck look great for building Google/Facebook-sized codebases, meson looks great for what most of our projects are.
- JoshTriplett 9y agoPersonally, I'd much rather see Meson than either one. But CMake is still a solid, mature choice here.
- lomnakkus 9y agoOne obvious issue with Meson is that it's not really available as a (statically-compiled, if you want) binary. I was an early adopter (years and years ago) of Scons, but the Python dependency turned out to be an absolute disaster, purely in terms of infrastructure (especially that everybody had to have a lot of "things" installed). While CMake isn't exactly great, a) it is reasonably understandable, and b) the boost build system was essentially a single-project-build system, and c) it's a huge improvement over autoconf, and d) it doesn't need a lot of infrastructure aside from what ships with it (to contrast with 'interpreted' build systems).
- yorwba 9y agoMy only experience with Bazel was building TensorFlow. I can't say that the builds were fully reproducible or very fast. That TensorFlow is a big project excuses the speed (most of the time was probably spent actually compiling), but I had to rebuild three times until setting the flag for GPU support had the desired effect. So whatever magic was supposed to deliver reproducibility was not working. Add to that issues with some Bazel processes hogging resources in the background and I was wishing for some good old makefiles.
- chubot 9y agoWhat did they use before? GNU make? (on Windows?) It seems like CMake is quite popular now, with LLVM having moved to it a few years ago.
- adzm 9y agob2 / bjam, a custom build tool that was bootstrapped via a script that just builds.
- noobermin 9y agoIf they have a tool that builds it, why require CMake? Why add an unneeded dependency?
- SXX 9y agoOne huge advantage: if your project already using CMake then you'll be able to include exact version of Boost library into your project as git submodule. Then it's will be built hassle-free across all of your toolchains and platforms. This will of course require some proper configuration on Boost side, but no doubt they'll handle it.
- lomnakkus 9y agoWell, partly because b2/bjam is aboslutely awful and obtuse, etc. etc. I did some semi-serious experimenting with it at one point and it was just... well, awful. It basically did very few things right. (BTW, don't take this as criticism of the authors of said system. I just don't "we" had learned enough and infrastructure was incredibly far behind what we have now. So I don't "blame" them in the least. It's just a product of its time.)
- sevensor 9y agoI'm not sure what it's like to maintain the build system, but my experience with CMake as a user has been great. It can even generate makefiles for nmake so I can do Windows builds from the comfort of the Windows command line, although I mostly use it under Linux. Under Linux, I've found that CMake is much friendlier when it comes to helping you fix your dependencies than autotools-based build systems.
- Twirrim 9y agoAs someone with no real experience with make/cmake other than "I've downloaded this thing, these are the instructions for compiling and installing it", what are the advantages of CMake over make?
- joelthelion 9y agoCmake uses make (among other backends) Think of Cmake as a portable, high level layer over make.
- deleted 9y ago[deleted]
- 8239849234 9y agoOver autoconf: Windows support. Otherwise autoconf is superior in every aspect.
- fizixer 9y ago> Otherwise autoconf is superior in every aspect. Now this is a statement I didn't expect. I currently use make for my simple projects and, as commented a few mintues ago, looking for insight into what makes a good build-system (ignoring popularity). I used automake/autoconf briefly but it always tripped me up (though I should admit I never learned it properly). Could you expand on why you think autoconf is superior?
- geezerjay 9y agoI've used autoconf/automake in some pet projects (a combo that's typically referred to as autotools), and I have to say that the biggest drawback of using that build system is its appallingly bad documentation. To me, the official GNU docs are unreadable, and the only useful and mildly palatable documentation available on the web comes in the form of blog posts published by people who managed to learn how to get autotools projects to work and took their time to tell the world how they managed to accomplish that feat of technical prowess. Once that initial part of the learning curve is surpassed, autotools presents itself as a remarkably robust and resilient build system which is highly extensible, which supports virtually all use cases that any user may need to implement. Build systems such as CMake are started as better alternatives to autotools, and they do succeed in that venture by providing better documentation and presenting a smoother learning curve to accomplish basic tasks. Yet, once a project grows out of the scope of basic use cases.... Everything starts to break, while autoconfs soldier on like a champ.
- LVB 9y agoThis is the first time I've thought about Boost Build since leaving my last job about 18 months ago. The selection by a few of Boost Build for internal projects at the company was easily one of the most divisive, time consuming, and frustrating decisions I've encountered. Even after lots of wiki docs and training, no one understood that thing. Probably <10% of devs could do little more than tweak existing .jam files without all sorts of problems. And probably <1% actually liked the tool, but it got wedged into a process and stayed there.
- fizixer 9y agomake, configure, autoconf/automake, m4 (I know it's just a macro language), cmake, scons, etc, etc, etc. Can anyone share a good survey article/paper on the fundamental issues related to build systems, or what is the criteria for a good system (other than popularity)? Is this a tricky issue because it's tangled with configuration-management and package-management, and OS-filesystem-hierarchy in general? (in which case you can not solve this problem without standardization efforts at multiple levels). I'm not looking whether to chose CMake or its competitors, but looking for insight into the minds of build-system creators (something deeper than just annoyance with existing tools). (addition of history discussion would be even better)
- taktoa 9y agoSection 10.2 and 10.3 of this PhD thesis are pretty good: https://nixos.org/~eelco/pubs/phd-thesis.pdf https://nixos.org/~eelco/pubs/phd-thesis.pdf
- buie8 9y agoHere's a paper titled "Non-recursive Make Considered Harmful: Build Systems at Scale" It has a pretty good overview of the what the goals of a build system should be, and section 7 compares several different build systems http://eprint.ncl.ac.uk/file_store/production/226639/BA1AC951-8C2E-46C8-92F1-74FA95507892.pdf http://eprint.ncl.ac.uk/file_store/production/226639/BA1AC95...
- fizixer 9y agoThanks to other responses for helpful documents. Replying to my own comment to add a 4-5 year old HN discussion about an article from 2003: https://news.ycombinator.com/item?id=7220917 https://news.ycombinator.com/item?id=7220917 edit: Discussion of Guix, a package management system that interacts with a given build system: https://news.ycombinator.com/item?id=4821488 https://news.ycombinator.com/item?id=4821488
- git-pull 9y agoBenefits to CMake: IDE Support: KDevelop and CLion both support CMake as a flag ship project file. Why? A CMakeLists.txt has all you need: the project's debug/release build commands, include's for completions, and library files. Growing ubiquity: More and more open source projects are build around CMake CoreCLR, Swift, lua, SFML, opencv, cafe, zlib, libevent, blender, protobuf Some fast facts about these tools: - CMake is complicated. Sure, there are macros. But it's not a bad thing. CMake's complexity is proportional to what it takes to do the job: finding header files and libraries across platforms, detecting compiler features, and so on. - This isn't the kind of a job that can be solved by a simple, beautiful 50 line file. For instance: Stuff like finding SDL2 header files across platforms is hard because OS leave them in /usr/include, /usr/local/include, then within that, some keep them under SDL or SDL2 within that. Ergo, custom modules need to be built to handle the differences that have organically manifested in distros over the years. - In order to have software binaries built for as many platforms as possible, a build system needs to be able to test that certain functions exist. For instance, tmux: https://github.com/tmux/tmux/blob/45ee118/configure.ac#L427 https://github.com/tmux/tmux/blob/45ee118/configure.ac#L427. The only way for tmux to know if it should "polyfill" getopt is to run a small snippet of code. If your system has it, it stores HAVE_GETOPT. If not, it has to get fill in getopt at https://github.com/tmux/tmux/blob/45ee118/compat/getopt.c https://github.com/tmux/tmux/blob/45ee118/compat/getopt.c via https://github.com/tmux/tmux/blob/45ee118/compat.h#L352 https://github.com/tmux/tmux/blob/45ee118/compat.h#L352 - Understand the point of these kind of tools is solve a problem: Getting your source to build across a range of platforms, not just Ubuntu! - Not to mention, CMake has compatibility for various generator outputs. For instance, it can output Visual Studio projects, XCode projects, and even more popular, Ninja (https://ninja-build.org/ https://ninja-build.org/) - CMake gives leaves helpful debug output when so you can get help when you're troubleshooting (cmake --system-information sysinfo.txt)
- santaclaus 9y ago> This isn't the kind of a job that can be solved by a simple, beautiful 50 line file. As a big CMake fan, I don't think CMake's success has anything to do with their super ugly custom language. What CMake does could be a lot more ergonomic, especially from a typical user's standpoint.
- weberc2 9y agoIt blows my mind that CMake is the premier build system for C++. I don't miss that dumpster fire. Too bad that C++ has invested so heavily in modernizing the language, but it can't invest in a sane, standard build tool. :(
- santaclaus 9y agoCMake is far more than a build tool.
- noobermin 9y agoThat doesn't really address their criticism, not that their "dumpster fire" label is very detailed.
- weberc2 9y agoThat's certainly part of the problem.
- santaclaus 9y agoOr one of its major advantages. Is there another tool that can generate IDE projects, in a cross platform manner, across a wide variety of compilers, operating systems, etc? I'd love to use a tool that looks nicer, but there is nothing (to my knowledge, I'd love to be proven wrong!) that can do what CMake does with the same breadth and transparency.
- weberc2 9y ago> Is there another tool that can generate IDE projects, in a cross platform manner, across a wide variety of compilers, operating systems, etc? You have the problem backwards. IDEs wouldn't need distinct project files if build systems could reasonably describe the project structure out of the box. There is no need for every tool to know about every other tool. This is a solved problem in most modern programming languages.