The math() Command

Let's learn about the math() command in CMake.

We'll cover the following

CMake also supports some simple arithmetical operations. See the online documentation for full details.

To evaluate a mathematical expression and store it in the <out> variable as the string in an optional <format> (HEXADECIMAL or DECIMAL), use the following signature:

Get hands-on with 1200+ tech skills courses.