cmake/Help/command/separate_arguments.rst

37 lines
1.3 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.
::
2017-07-20 19:35:53 +02:00
separate_arguments(<var> <NATIVE|UNIX|WINDOWS>_COMMAND "<args>")
2014-08-03 19:52:23 +02:00
2017-07-20 19:35:53 +02:00
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
2017-07-20 19:35:53 +02: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.
2017-07-20 19:35:53 +02:00
The ``NATIVE_COMMAND`` mode parses a Windows command-line if the host
system is Windows, and a UNIX command-line otherwise.
2016-10-30 18:24:19 +01:00
.. _`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.