cmMacroCommand.h 1.53 KB
Newer Older
1 2
/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
   file Copyright.txt or https://cmake.org/licensing for details.  */
Ken Martin's avatar
Ken Martin committed
3 4 5
#ifndef cmMacroCommand_h
#define cmMacroCommand_h

6
#include <cmConfigure.h>
7

8 9
#include <string>
#include <vector>
Brad King's avatar
Brad King committed
10

11
#include "cmCommand.h"
Ken Martin's avatar
Ken Martin committed
12
#include "cmFunctionBlocker.h"
13 14 15 16
#include "cmListFileCache.h"

class cmExecutionStatus;
class cmMakefile;
Ken Martin's avatar
Ken Martin committed
17 18 19 20

class cmMacroFunctionBlocker : public cmFunctionBlocker
{
public:
21
  cmMacroFunctionBlocker() { this->Depth = 0; }
22 23 24 25
  ~cmMacroFunctionBlocker() CM_OVERRIDE {}
  bool IsFunctionBlocked(const cmListFileFunction&, cmMakefile& mf,
                         cmExecutionStatus&) CM_OVERRIDE;
  bool ShouldRemove(const cmListFileFunction&, cmMakefile& mf) CM_OVERRIDE;
26

Ken Martin's avatar
Ken Martin committed
27 28
  std::vector<std::string> Args;
  std::vector<cmListFileFunction> Functions;
Ken Martin's avatar
Ken Martin committed
29
  int Depth;
Ken Martin's avatar
Ken Martin committed
30 31
};

32
/// Starts macro() ... endmacro() block
Ken Martin's avatar
Ken Martin committed
33 34 35 36 37 38
class cmMacroCommand : public cmCommand
{
public:
  /**
   * This is a virtual constructor for the command.
   */
39
  cmCommand* Clone() CM_OVERRIDE { return new cmMacroCommand; }
Ken Martin's avatar
Ken Martin committed
40 41 42 43 44

  /**
   * This is called when the command is first encountered in
   * the CMakeLists.txt file.
   */
45 46
  bool InitialPass(std::vector<std::string> const& args,
                   cmExecutionStatus& status) CM_OVERRIDE;
Ken Martin's avatar
Ken Martin committed
47

48 49 50
  /**
   * This determines if the command is invoked when in script mode.
   */
51
  bool IsScriptable() const CM_OVERRIDE { return true; }
52

Ken Martin's avatar
Ken Martin committed
53 54 55
  /**
   * The name of the command as specified in CMakeList.txt.
   */
56
  std::string GetName() const CM_OVERRIDE { return "macro"; }
Ken Martin's avatar
Ken Martin committed
57 58 59
};

#endif