cmake/Help/command/separate_arguments.rst

34 lines
1.2 KiB
ReStructuredText
Raw Normal View History

2014-08-03 19:52:23 +02:00
separate_arguments
------------------
Parse space-separated arguments into a semicolon-separated list.
::
separate_arguments(<var> <UNIX|WINDOWS>_COMMAND "<args>")
Parses a unix- or windows-style command-line string "<args>" and
2015-11-17 17:22:37 +01:00
stores a semicolon-separated list of the arguments in ``<var>``. The
2014-08-03 19:52:23 +02:00
entire command line must be given in one "<args>" argument.
2015-11-17 17:22:37 +01:00
The ``UNIX_COMMAND`` mode separates arguments by unquoted whitespace. It
2014-08-03 19:52:23 +02:00
recognizes both single-quote and double-quote pairs. A backslash
2016-10-30 18:24:19 +01:00
escapes the next literal character (``\"`` is ``"``); there are no special
escapes (``\n`` is just ``n``).
2014-08-03 19:52:23 +02:00
2015-11-17 17:22:37 +01:00
The ``WINDOWS_COMMAND`` mode parses a windows command-line using the same
2014-08-03 19:52:23 +02:00
syntax the runtime library uses to construct argv at startup. It
separates arguments by whitespace that is not double-quoted.
Backslashes are literal unless they precede double-quotes. See the
2016-10-30 18:24:19 +01:00
MSDN article `Parsing C Command-Line Arguments`_ for details.
.. _`Parsing C Command-Line Arguments`: https://msdn.microsoft.com/library/a1y7w461.aspx
2014-08-03 19:52:23 +02:00
::
2016-10-30 18:24:19 +01:00
separate_arguments(<var>)
2014-08-03 19:52:23 +02:00
2016-10-30 18:24:19 +01:00
Convert the value of ``<var>`` to a semi-colon separated list. All
2014-08-03 19:52:23 +02:00
spaces are replaced with ';'. This helps with generating command
lines.