Follows John Lamp's excellent CMake tutorial http://johnlamp.net/cmake-tutorial.html