cmVariableRequiresCommand.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #ifndef cmVariableRequiresCommand_h
  11. #define cmVariableRequiresCommand_h
  12. #include "cmCommand.h"
  13. /** \class cmVariableRequiresCommand
  14. * \brief Displays a message to the user
  15. *
  16. */
  17. class cmVariableRequiresCommand : public cmCommand
  18. {
  19. public:
  20. /**
  21. * This is a virtual constructor for the command.
  22. */
  23. virtual cmCommand* Clone()
  24. {
  25. return new cmVariableRequiresCommand;
  26. }
  27. /**
  28. * This is called when the command is first encountered in
  29. * the CMakeLists.txt file.
  30. */
  31. virtual bool InitialPass(std::vector<std::string> const& args,
  32. cmExecutionStatus &status);
  33. /**
  34. * The name of the command as specified in CMakeList.txt.
  35. */
  36. virtual const char* GetName() { return "variable_requires";}
  37. /**
  38. * Succinct documentation.
  39. */
  40. virtual const char* GetTerseDocumentation()
  41. {
  42. return "Deprecated. Use the if() command instead.";
  43. }
  44. /**
  45. * More documentation.
  46. */
  47. virtual const char* GetFullDocumentation()
  48. {
  49. return
  50. "Assert satisfaction of an option's required variables.\n"
  51. " variable_requires(TEST_VARIABLE RESULT_VARIABLE\n"
  52. " REQUIRED_VARIABLE1\n"
  53. " REQUIRED_VARIABLE2 ...)\n"
  54. "The first argument (TEST_VARIABLE) is the name of the variable to be "
  55. "tested, if that variable is false nothing else is done. If "
  56. "TEST_VARIABLE is true, then "
  57. "the next argument (RESULT_VARIABLE) is a variable that is set to true "
  58. "if all the required variables are set. "
  59. "The rest of the arguments are variables that must be true or not "
  60. "set to NOTFOUND to avoid an error. If any are not true, an error "
  61. "is reported.";
  62. }
  63. /** This command is kept for compatibility with older CMake versions. */
  64. virtual bool IsDiscouraged()
  65. {
  66. return true;
  67. }
  68. cmTypeMacro(cmVariableRequiresCommand, cmCommand);
  69. };
  70. #endif