1
0

cmVariableRequiresCommand.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 cmVariableRequiresCommand_h
  14. #define cmVariableRequiresCommand_h
  15. #include "cmStandardIncludes.h"
  16. #include "cmCommand.h"
  17. /** \class cmVariableRequiresCommand
  18. * \brief Displays a message to the user
  19. *
  20. */
  21. class cmVariableRequiresCommand : public cmCommand
  22. {
  23. public:
  24. /**
  25. * This is a virtual constructor for the command.
  26. */
  27. virtual cmCommand* Clone()
  28. {
  29. return new cmVariableRequiresCommand;
  30. }
  31. /**
  32. * This is called when the command is first encountered in
  33. * the CMakeLists.txt file.
  34. */
  35. virtual bool InitialPass(std::vector<std::string> const& args);
  36. ///!
  37. virtual void FinalPass();
  38. /**
  39. * The name of the command as specified in CMakeList.txt.
  40. */
  41. virtual const char* GetName() { return "VARIABLE_REQUIRES";}
  42. /**
  43. * Succinct documentation.
  44. */
  45. virtual const char* GetTerseDocumentation()
  46. {
  47. return "Assert satisfaction of an option's required variables.";
  48. }
  49. /**
  50. * More documentation.
  51. */
  52. virtual const char* GetFullDocumentation()
  53. {
  54. return
  55. " VARIABLE_REQUIRES(TEST_VARIABLE RESULT_VARIABLE\n"
  56. " REQUIRED_VARIABLE1\n"
  57. " REQUIRED_VARIABLE2 ...)\n"
  58. "The first argument (TEST_VARIABLE) is the name of the variable to be "
  59. "tested, if that variable is false nothing else is done. If "
  60. "TEST_VARIABLE is true, then "
  61. "the next arguemnt (RESULT_VARIABLE) is a vairable that is set to true "
  62. "if all the required variables are set."
  63. "The rest of the arguments are variables that must be true or not "
  64. "set to NOTFOUND to avoid an error. If any are not true, an error "
  65. "is reported.";
  66. }
  67. cmTypeMacro(cmVariableRequiresCommand, cmCommand);
  68. private:
  69. std::string m_ErrorMessage;
  70. std::vector<std::string> m_Arguments;
  71. bool m_RequirementsMet;
  72. };
  73. #endif