Despite my current monogamous relationship with C#, I've spent most of my career writing code which really needed to be cross-platform.  I've come to understand how very hard it is to create any non-trivial body of code that runs on multiple platforms, and I have a great deal of admiration for solutions that actually work well.

One of the toughest parts of cross-platform development is the build system.  No matter how clean and portable your C code is, getting the tree to build on multiple platforms is a whole different problem.

One solution I have used in the past is to do a completely Unix-centric build system with bash and make, using cygwin to run it under Windows.  This works very well, except that it really annoys the folks who prefer Visual Studio project files.  (I've had people assert that my tendency to run emacs on Windows is proof that my parents were brother and sister.)

Personally, I have always believed that build management was by far the weakest part of the Visual Studio environment.  MSBuild looks like a step in the right direction.  VS.NET is actually pretty decent.  (The build system for Vault is done entirely in a VS.NET .sln file, and it's quite complicated.)  Previous Visual Studio releases simply didn't have the power to do custom builds of larger projects, and the result wasn't cross-platform anyway.

This week I discovered a nifty tool I had never seen before.  It's called CMake, and it's the build system used for Kitware's Visualization Toolkit.  I've seen lots of alternatives to 'make', but this tool is surprisingly different and deeply neato.

I started by downloading the VTK tarball on a MacOS X system, which from my point of view is Unix with a nice UI.  I ran CMake and edited the configuration settings without much difficulty.  But then, instead of performing the build, CMake generated a regular Unix makefile.  I typed 'make' and the entire tree was built with no problems.  I was impressed with the fact that CMake was not replacing my standard toolset, but I didn't really appreciate this tool until I repeated the build on Windows.

I downloaded the exact same tarball to my Windows machine.  I ran CMake and once again edited the configuration settings.  When I told CMake to proceed, it generated a complete set of Visual Studio .NET 2003 project and solution files.  I opened the .sln and built the entire tree with no problems.

I didn't go further, but I saw indications that CMake can generate output for other build systems as well, including CodeWarrior on the Mac, and presumably others.

Very, very cool.  If I ever end up working on a cross-platform project again, I will be inclined to use CMake.

 MMM in Russian

I'm told that this is a Russian translation of Make More Mistakes.  If it were actually a Russian version of Hamlet I wouldn't know the difference.

 Getting Started with Your Own Software Company

My latest Business of Software column is now available on the MSDN website.