1 /*============================================================================
2 CMake - Cross Platform Makefile Generator
3 Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
5 Distributed under the OSI-approved BSD License (the "License");
6 see accompanying file Copyright.txt for details.
8 This software is distributed WITHOUT ANY WARRANTY; without even the
9 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the License for more information.
11 ============================================================================*/
12 #ifndef cmMathCommand_h
13 #define cmMathCommand_h
15 #include "cmCommand.h"
17 /// Mathematical expressions: math(EXPR ...) command.
18 class cmMathCommand : public cmCommand
22 * This is a virtual constructor for the command.
24 virtual cmCommand* Clone()
26 return new cmMathCommand;
30 * This is called when the command is first encountered in
31 * the CMakeLists.txt file.
33 virtual bool InitialPass(std::vector<std::string> const& args,
34 cmExecutionStatus &status);
37 * This determines if the command is invoked when in script mode.
39 virtual bool IsScriptable() const { return true; }
42 * The name of the command as specified in CMakeList.txt.
44 virtual const char* GetName() const { return "math";}
47 * Succinct documentation.
49 virtual const char* GetTerseDocumentation() const
51 return "Mathematical expressions.";
57 virtual const char* GetFullDocumentation() const
60 " math(EXPR <output variable> <math expression>)\n"
61 "EXPR evaluates mathematical expression and return result in the "
62 "output variable. Example mathematical expression is "
63 "'5 * ( 10 + 13 )'. Supported operators are "
64 "+ - * / % | & ^ ~ << >> * / %. They have the same meaning "
65 " as they do in c code.";
68 cmTypeMacro(cmMathCommand, cmCommand);
71 bool HandleExprCommand(std::vector<std::string> const& args);