cmSeparateArgumentsCommand.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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 cmSeparateArgumentsCommand_h
  14. #define cmSeparateArgumentsCommand_h
  15. #include "cmCommand.h"
  16. /** \class cmSeparateArgumentsCommand
  17. * \brief SeparateArguments a CMAKE variable
  18. *
  19. * cmSeparateArgumentsCommand sets a variable to a value with expansion.
  20. */
  21. class cmSeparateArgumentsCommand : public cmCommand
  22. {
  23. public:
  24. /**
  25. * This is a virtual constructor for the command.
  26. */
  27. virtual cmCommand* Clone()
  28. {
  29. return new cmSeparateArgumentsCommand;
  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. cmExecutionStatus &status);
  37. /**
  38. * This determines if the command is invoked when in script mode.
  39. */
  40. virtual bool IsScriptable() { return true; }
  41. /**
  42. * The name of the command as specified in CMakeList.txt.
  43. */
  44. virtual const char* GetName() {return "separate_arguments";}
  45. /**
  46. * Succinct documentation.
  47. */
  48. virtual const char* GetTerseDocumentation()
  49. {
  50. return
  51. "Parse space-separated arguments into a semicolon-separated list.";
  52. }
  53. /**
  54. * More documentation.
  55. */
  56. virtual const char* GetFullDocumentation()
  57. {
  58. return
  59. " separate_arguments(<var> <UNIX|WINDOWS>_COMMAND \"<args>\")\n"
  60. "Parses a unix- or windows-style command-line string \"<args>\" and "
  61. "stores a semicolon-separated list of the arguments in <var>. "
  62. "The entire command line must be given in one \"<args>\" argument."
  63. "\n"
  64. "The UNIX_COMMAND mode separates arguments by unquoted whitespace. "
  65. "It recognizes both single-quote and double-quote pairs. "
  66. "A backslash escapes the next literal character (\\\" is \"); "
  67. "there are no special escapes (\\n is just n)."
  68. "\n"
  69. "The WINDOWS_COMMAND mode parses a windows command-line using the "
  70. "same syntax the runtime library uses to construct argv at startup. "
  71. "It separates arguments by whitespace that is not double-quoted. "
  72. "Backslashes are literal unless they precede double-quotes. "
  73. "See the MSDN article \"Parsing C Command-Line Arguments\" for details."
  74. "\n"
  75. " separate_arguments(VARIABLE)\n"
  76. "Convert the value of VARIABLE to a semi-colon separated list. "
  77. "All spaces are replaced with ';'. This helps with generating "
  78. "command lines.";
  79. }
  80. cmTypeMacro(cmSeparateArgumentsCommand, cmCommand);
  81. };
  82. #endif