[CMake] any arithmetic expansion?

Filipe Sousa filipe at ipb.pt
Fri Oct 27 05:46:37 EDT 2006


Tristan Carel wrote:
> Hi,
> 
> Does CMake performs arithmetic expansion?
> Do we have to use an external tool? (like bc, or expr)
> 
> I don't find anything about it on the bug tracker.
> 
> I would be fantastic to be able to write something like this:
> SET(Foo 2)
> SET(Bar $EVAL{0x101000 + ${Foo}})
> 
> To avoid complexity growth of the parser but still be
> platform-independant, maybe you could add a command available with
> CMake -E.
> ==> CMAKE -E EVAL "0x101000 + ${Foo}"
> 
> The worst case would be a module FindBc.cmake which provides a macro Bc_EVAL
> 
> my 2 cents.

cmake version 2.5-20061010
MATH
  Mathematical expressions.

    MATH(EXPR <output variable> <math expression>)

  EXPR evaluates mathematical expression and return result in the output
  variable.  Example mathematical expression is '5 * ( 10 + 13 )'.

-- 
Filipe Sousa

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://public.kitware.com/pipermail/cmake/attachments/20061027/9fe7a455/signature.pgp


More information about the CMake mailing list