cmake_parse_arguments: Add option to read arguments from ARGC/ARGV#

The `ARGC`/`ARGV#` variables in function scope hold the original
arguments with no ;-list flattening.  Add a way for functions to
cleanly parse arguments that may contain `;`.  This also avoids
extra copying of the arguments.

Co-Author: Brad King <brad.king@kitware.com>
This commit is contained in:
Bill Hoffman
2016-09-07 16:47:23 -04:00
committed by Brad King
parent f506489d1e
commit cb299acc27
17 changed files with 139 additions and 4 deletions

View File

@@ -11,6 +11,17 @@ respective options.
cmake_parse_arguments(<prefix> <options> <one_value_keywords>
<multi_value_keywords> args...)
cmake_parse_arguments(PARSE_ARGV N <prefix> <options> <one_value_keywords>
<multi_value_keywords>)
The first signature reads processes arguments passed in the ``args...``.
This may be used in either a :command:`macro` or a :command:`function`.
The ``PARSE_ARGV`` signature is only for use in a :command:`function`
body. In this case the arguments that are parsed come from the
``ARGV#`` variables of the calling function. The parsing starts with
the Nth argument, where ``N`` is an unsigned integer. This allows for
the values to have special characters like ``;`` in them.
The ``<options>`` argument contains all options for the respective macro,
i.e. keywords which can be used when calling the macro without any value