diff options
author | Daniel Franke <franke@edf-online.de> | 2018-05-18 19:59:46 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-07-03 13:55:58 (GMT) |
commit | 5dbee9d2d0f68e1fc343d04ac00a4a35d43df6fa (patch) | |
tree | 85375da2fabdfbc7982fe4ba58a76acc3167c71e /Help/command/math.rst | |
parent | 8661e7052c4f711f13e7168231276e23c4c0defd (diff) | |
download | CMake-5dbee9d2d0f68e1fc343d04ac00a4a35d43df6fa.zip CMake-5dbee9d2d0f68e1fc343d04ac00a4a35d43df6fa.tar.gz CMake-5dbee9d2d0f68e1fc343d04ac00a4a35d43df6fa.tar.bz2 |
math: Add options to calculate and format output as hexadecimal
Diffstat (limited to 'Help/command/math.rst')
-rw-r--r-- | Help/command/math.rst | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/Help/command/math.rst b/Help/command/math.rst index f99dc3d..63af931 100644 --- a/Help/command/math.rst +++ b/Help/command/math.rst @@ -5,10 +5,26 @@ Mathematical expressions. :: - math(EXPR <output-variable> <math-expression>) + math(EXPR <output-variable> <math-expression> [OUTPUT_FORMAT <format>]) ``EXPR`` evaluates mathematical expression and returns result in the output variable. Example mathematical expression is ``5 * (10 + 13)``. Supported operators are ``+``, ``-``, ``*``, ``/``, ``%``, ``|``, ``&``, ``^``, ``~``, ``<<``, ``>>``, and ``(...)``. They have the same meaning as they do in C code. + +Numeric constants are evaluated in decimal or hexadecimal representation. + +The result is formatted according to the option "OUTPUT_FORMAT" , +where ``<format>`` is one of: +:: + + HEXADECIMAL = Result in output variable will be formatted in C code + Hexadecimal notation. + DECIMAL = Result in output variable will be formatted in decimal notation. + + +For example:: + + math(EXPR value "100 * 0xA" DECIMAL) results in value is set to "1000" + math(EXPR value "100 * 0xA" HEXADECIMAL) results in value is set to "0x3e8" |