Welcome to the Bake project

Bake is a buildsystem generator, intended to simplify the creation of projects which make use of  CMake. Bake is to CMake as automake is to autoconf, in principle.

Bake addresses several weaknesses of CMake:

  • CMake requires using CMakeLists.txt files for every subdirectory of a project. For many projects, especially large ones, it can be prohibitive to manage these files. Bake uses a single top-level file to generate the buildsystem.
  • Passing options to a CMake configuration requires either a GUI or difficult-to-read -D options passed to the cmake program. Bake generates a ./configure script which presents a familiar autoconf-style interface on UNIX systems.
  • CMake requires the use of separate Find modules to locate external programs and libraries. While this is a good idea in principle, in practice no package can assume that a user has a particular Find module, and must therefore bundle with itself all such modules that are not part of the CMake core distribution. Bake optionally embeds the Find modules into the top-level file, and can also refer to bundled modules.
  • CMake uses a proprietary scripting language in order to maintain cross-platorm compatibility. Autotools used m4 in much the same way. Unfortunately, few people want to be bothered with learning an entirely new scripting language just to make use of a buildsystem. One of Bake's goals is to offer the ability to code the buildsystem using familiar languages such as  PHP,  Python, and  Ruby, as well as newer languages like  QMD. The result remains cross-platform, as Bake's purpose is to generate a CMake buildsystem, not to replace it.

The simplest Bake file, written in PHP, might look something like this:

<?php

$CMAKE = include('bake.php');
// Or: include('bake.php'); $CMAKE = new Baker;
$CMAKE->startProject('HELLO', 'Hello World');
$CMAKE->addExecutable('hello', array('hello.c', 'hello_utils.c'));
$CMAKE->emit();
?>

Or, in Python:

# -*- coding: utf-8 -*-

from Bake import Baker
CMAKE = Baker('HELLO', 'Hello World')
CMAKE.addExecutable('hello', ('hello.c', 'hello_utils.c'))
CMAKE.emit()

Or, in QMD:

#!qmd

#include "bake.qmd"
$CMAKE = new Baker('HELLO', 'Hello World');
$CMAKE->addExecutable('hello', (('hello.c', 'hello_utils.c')) );
$CMAKE->emit();

When run through Bake (by executing the source file itself), this will produce a CMakeLists.txt to compile hello.c and hello_utils.c to hello, as well as a ./configure script to simplify invoking CMake.

Yes, this is similar to invoking Python's setuptools.

Starting Points