cmIfCommand.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*=========================================================================
  2. Program: Insight Segmentation & Registration Toolkit
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Insight Consortium. All rights reserved.
  8. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #ifndef cmIfCommand_h
  14. #define cmIfCommand_h
  15. #include "cmStandardIncludes.h"
  16. #include "cmCommand.h"
  17. #include "cmFunctionBlocker.h"
  18. /** \class cmIfFunctionBlocker
  19. * \brief subclass of function blocker
  20. *
  21. *
  22. */
  23. class cmIfFunctionBlocker : public cmFunctionBlocker
  24. {
  25. public:
  26. cmIfFunctionBlocker() {}
  27. virtual ~cmIfFunctionBlocker() {}
  28. virtual bool IsFunctionBlocked(const char *name,
  29. const std::vector<std::string> &args,
  30. cmMakefile &mf);
  31. virtual bool ShouldRemove(const char *name,
  32. const std::vector<std::string> &args,
  33. cmMakefile &mf);
  34. virtual void ScopeEnded(cmMakefile &mf);
  35. std::vector<std::string> m_Args;
  36. };
  37. /** \class cmIfCommand
  38. * \brief starts an if block
  39. *
  40. * cmIfCommand starts an if block
  41. */
  42. class cmIfCommand : public cmCommand
  43. {
  44. public:
  45. /**
  46. * This is a virtual constructor for the command.
  47. */
  48. virtual cmCommand* Clone()
  49. {
  50. return new cmIfCommand;
  51. }
  52. /**
  53. * This is called when the command is first encountered in
  54. * the CMakeLists.txt file.
  55. */
  56. virtual bool InitialPass(std::vector<std::string> const& args);
  57. /**
  58. * The name of the command as specified in CMakeList.txt.
  59. */
  60. virtual const char* GetName() { return "IF";}
  61. /**
  62. * Succinct documentation.
  63. */
  64. virtual const char* GetTerseDocumentation()
  65. {
  66. return "start an if block";
  67. }
  68. /**
  69. * This determines if the command gets propagated down
  70. * to makefiles located in subdirectories.
  71. */
  72. virtual bool IsInherited() {return true;}
  73. /**
  74. * More documentation.
  75. */
  76. virtual const char* GetFullDocumentation()
  77. {
  78. return
  79. "IF (define) Starts an if block. Optionally it can be invoked "
  80. "using (NOT define) (def AND def2) (def OR def2) (def MATCHES def2) "
  81. "(COMMAND cmd) (EXISTS file) MATCHES checks if def matches the "
  82. "regular expression def2. COMMAND checks if the cmake command cmd "
  83. "is in this cmake executable. EXISTS file checks if file exists";
  84. }
  85. cmTypeMacro(cmIfCommand, cmCommand);
  86. };
  87. #endif