A common setup I see in open source projects is to use makefiles as a way to build its source code. The code itself is standard C++ (and thus portable to different compilers and operating systems), however that does me no good if I have to struggle to get it to compile on my platform (Windows in particular). This is the same as me handing off my third party library to a Linux developer with Visual Studio projects in it. They can’t really do anything with that. The trouble I have to go through to install Cygwin and learn the required build steps and tools isn’t worth the time to me.
Why is it that as software engineers we neglect our build systems? I strongly believe the build system is just as important as the code itself, especially for open source middleware projects (Take OpenSSL for example). A build system should address what I believe are the two most important ideas. First, the build system has to allow the developer to build the source using the development environment/tools of their choosing. Second, the build system needs to be easily automated (for not only generating automatic builds but for automated testing too).
Makefile scripts can certainly address the second point, however the first point they do not address. If I am a Windows developer and decide to contribute to an open source code base dominated mostly by Linux developers, I’m a bit out of luck in the “convenience” department. Working out of VIM/EMACS and ‘make’ suits a Linux developer, especially if they don’t have a GUI frontend for their OS. However, on Windows I have Visual Studio and I would love the ability to take advantage of using that IDE (or any IDE for that matter). Not only does this benefit the Windows developers, but it encourages more people to join in on the project because we can jump straight into worrying about the code and not have to deal with a frustrating and confusing build pipeline.
This philosophy on build systems is something I’ve acquired over the years after I was introduced to CMake. It’s a fantastic tool that you can use to generate scripts/projects for the build tools of your choice. For example, I can take the same CMake scripts and generate makefiles on Linux and Visual Studio project files on Windows. This is such an obviously great thing to have, I am quite frankly appalled that more projects (both open source and proprietary, such as products you will find at software companies) don’t use them. It’s been a struggle so far to get people to migrate to CMake at the company I’m working for now, but it’s not because they fail to find the value in the tool itself. It’s just a matter of migrating over (which is a whole process in itself, especially for a large company). Fortunately it’s a lot easier to migrate to something like this in an open source project where things are not as strict and risk is lower, so I hope to see more things moving towards CMake in the future. The least I can do is blog about what I feel is important and share information about CMake itself. Hopefully this will help spread the word.