CMake is a unified, cross-platform, open-source build system that enables developers to build, test and package software by specifying build parameters in simple, portable text files. It works in a compiler-independent manner and the build process works in conjunction with native build environments, such as Make, Apple‘s Xcode and Microsoft Visual Studio. It also has minimal dependencies, C++ only. CMake is open source software and is developed by Kitware. (taken from Wikipedia)
But you already know that because CMake is the build system we use in KDE ðŸ™‚
When I started to use CMake at work to port a large project from Windows to Linux, I needed to write a lot of modules (“finders”). Those modules had to work on Windows and Linux, and sometimes with different versions of some of the third-party dependencies. Parsing header files, Windows registry entries, etc was often required.
If you have ever parsed text, you know you powerful regular expressions are. If you use old software, you know how great Perl Compatible Regular Expressions (PCRE) are because you do not have them available :-).
Regular Expressions are available in CMake but the implementation is not PCRE but just POSIX Extended Regular Expressions, which are not as good.
A few years ago, I started to add PCRE support to CMake, using the canonical solution for this: the PCRE library by Philip Hazel. Back then, I implemented support for PCRE for the CMake “string” command; it worked but I didn’t finish the implementation because it required some important changes in CMake and back then (they were still using CVS!) contributing was difficult.
My wish for today: implement PCRE support for CMake.
These are the commands and macros you’ll need to touch:
If you want my source code, just ask me.
The implementation itself is relatively easy, especially if you use Google’s C++ wrapper to PCRE, which is part of PCRE itself. Essentially, you need to write a wrapper to cmsys::RegularExpression and pcrecpp::RE and use that wrapper where cmsys::RegularExpression is currently being used. The reason you need this wrapper is cmsys::RegularExpression supports some operations pcrecpp::RE doesn’t, such as going from a match to the previous or next match. The mapping from newRegexWrapper to cmsys::RegularExpression is direct, the mapping from newRegexWrapper to pcrecpp::RE requires some code and state tracking but not a lot.
Debajyoti Datta will be implementing this in Season of KDE 2011, I will be the mentor He failed.