Backend & AI

What is CMake and CTest (builds and tests)

What it is

CMake builds a C++ program with one command on Linux, macOS and Windows, and CTest runs its tests. For the client this means the code builds on more than the developer's machine and the formulas are checked.

How we use it

The FEFCO box die-line library for a packaging manufacturer is built with CMake and plugs into production software as an ordinary library. Tests for the formulas, nesting and input validation run through CTest.

Where it helps a business

  • A calculation is embedded into production software, and people other than its author must be able to build it.
  • A formula error is expensive, found only at cutting time, so formulas must be checked automatically.

How we use it

The FEFCO box die-line library for a packaging manufacturer builds with CMake 3.14 or newer on Linux, macOS and Windows, with no external dependencies. One command builds the library, a utility for manual calculations and the tests. Tests for the formulas, nesting, input validation and style-code parsing run through CTest. The reference values (a 300×200×150 mm box in 3 mm board gives a 1047×356 mm blank) were verified by running the code.

Calculation services for manufacturing are under Automation.

Common problems

  • Spreadsheet calculations. Before the library, errors came from spreadsheet formulas: board thickness is easy to forget, and every style has its own formula. Code with tests catches such errors before cutting.
  • A test checks the formula, not the plant. The creasing allowance is an approximation and is checked against a specific plant's tooling.

When you do not need it

Python scripts and bots do not need CMake: they have their own build and test tools.

← All terms

Need a website, a bot or automation?

Terms explained — now let's get to work: tell us about the task and we'll turn it into a clear work plan.