cmVariableRequiresCommand.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 "cmCommand.h"
  16. /** \class cmVariableRequiresCommand
  17. * \brief Displays a message to the user
  18. *
  19. */
  20. class cmVariableRequiresCommand : public cmCommand
  21. {
  22. public:
  23. /**
  24. * This is a virtual constructor for the command.
  25. */
  26. virtual cmCommand* Clone()
  27. {
  28. return new cmVariableRequiresCommand;
  29. }
  30. /**
  31. * This is called when the command is first encountered in
  32. * the CMakeLists.txt file.
  33. */
  34. virtual bool InitialPass(std::vector<std::string> const& args);
  35. ///!
  36. virtual void FinalPass();
  37. /**
  38. * The name of the command as specified in CMakeList.txt.
  39. */
  40. virtual const char* GetName() { return "VARIABLE_REQUIRES";}
  41. /**
  42. * Succinct documentation.
  43. */
  44. virtual const char* GetTerseDocumentation()
  45. {
  46. return "Assert satisfaction of an option's required variables.";
  47. }
  48. /**
  49. * More documentation.
  50. */
  51. virtual const char* GetFullDocumentation()
  52. {
  53. return
  54. " VARIABLE_REQUIRES(TEST_VARIABLE RESULT_VARIABLE\n"
  55. " REQUIRED_VARIABLE1\n"
  56. " REQUIRED_VARIABLE2 ...)\n"
  57. "The first argument (TEST_VARIABLE) is the name of the variable to be "
  58. "tested, if that variable is false nothing else is done. If "
  59. "TEST_VARIABLE is true, then "
  60. "the next arguemnt (RESULT_VARIABLE) is a vairable that is set to true "
  61. "if all the required variables are set."
  62. "The rest of the arguments are variables that must be true or not "
  63. "set to NOTFOUND to avoid an error. If any are not true, an error "
  64. "is reported.";
  65. }
  66. cmTypeMacro(cmVariableRequiresCommand, cmCommand);
  67. private:
  68. std::string m_ErrorMessage;
  69. std::vector<std::string> m_Arguments;
  70. bool m_RequirementsMet;
  71. };
  72. #endif