At work I recently had to look for a Unit Test Framework that’s usable on Windows. We had used the great CppUnit library to drive our unit tests for our Embedded Linux applications before and hence I decided I’d look into that first. Maybe I should explain first, that the original CppUnit project was recently forked by the Document Foundation (that’s the girls / guys driving LibreOffice) as the original project seems to be dead for some time now. Even some major Linux Distributions already switched to this fork, one of them being Debian – which is shipping 1.13.1 in Jessie. Driven by the Open Source thought many of our Windows (Embedded) applications are being compiled using the MinGW Toolchain (essentially that’s the GNU Compiler Collection (GCC) accompanied by some GNU Tools). And that’s exactly where the pain began.
CppUnit mainly ships for usage with two build systems – one for Microsoft Visual Studio based solutions and an Autotools based build system (there are some others, like for the Borland C++ Compiler, but I didn’t get to try them). Try to make either of them work with MinGW. Yeah right. Apart from that the build systems are cluttered all over the place and some of them are horrendously outdated.
So I decided to take a look into what could be done to improve the situation. A few months back we decided to switch to CMake based build systems at work (CMake is awesome, btw) and so I started porting CppUnit to make use of this build system. Unfortunately I realized very soon that it would be hard work getting all components to work again, as some of them did not get the love they deserved (I’m especially pointing at the Qt based test runner, which was still using the quite outdated Qt3 libraries). Getting the library itself to build was quite easy.
That said, in the meantime my changes made it into the official Git repository hosted at freedesktop.org and at the current state all components except the MFC based stuff are building just fine on all platforms supported by CMake and meeting the minimum compiler requirements – which should be all recent compilers starting with the MSVC 2005 compiler and GCC 4.x. So “recent” is quite relative in this sense. I’ve also almost completely rewritten the Qt Test Runner library and it now makes use of either Qt4 or Qt5. So, all of these changes can be found in the feature/cmake branch of the official CppUnit Git repository. If you’re interested, just clone it and build the good stuff. 🙂