cmSeparateArgumentsCommand.h 3.0 KB

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