diff options
| author | Lang Hames <lhames@gmail.com> | 2017-08-17 18:21:53 +0000 |
|---|---|---|
| committer | Lang Hames <lhames@gmail.com> | 2017-08-17 18:21:53 +0000 |
| commit | df1e59b6406fc369556eefb06638daf6976063a7 (patch) | |
| tree | 20fa022878efab5c5277c1a45bc2719820b0b6bd /llvm/docs/CMakePrimer.rst | |
| parent | 3a6a2d26c6dabdf574402298680aa0f03f99b437 (diff) | |
| download | bcm5719-llvm-df1e59b6406fc369556eefb06638daf6976063a7.tar.gz bcm5719-llvm-df1e59b6406fc369556eefb06638daf6976063a7.zip | |
[docs] Tweak phrasing of the varargs explanation in the command section of the
CMake primer.
This moves the introduction of the ARGV/ARGN variables up to immmediately follow
the introduction of the concept of variable argument functions, and explicitly
connects this concept to C varargs functions.
llvm-svn: 311113
Diffstat (limited to 'llvm/docs/CMakePrimer.rst')
| -rw-r--r-- | llvm/docs/CMakePrimer.rst | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/llvm/docs/CMakePrimer.rst b/llvm/docs/CMakePrimer.rst index 14e8a273690..7f9bc727965 100644 --- a/llvm/docs/CMakePrimer.rst +++ b/llvm/docs/CMakePrimer.rst @@ -333,10 +333,13 @@ When defining a CMake command handling arguments is very useful. The examples in this section will all use the CMake ``function`` block, but this all applies to the ``macro`` block as well. -CMake commands can have named arguments, but all commands are implicitly -variable argument. If the command has named arguments they are required and must -be specified at every call site. Below is a trivial example of providing a -wrapper function for CMake's built in function ``add_dependencies``. +CMake commands can have named arguments that are requried at every call site. In +addition, all commands will implicitly accept a variable number of extra +arguments (In C parlance, all commands are varargs functions). When a command is +invoked with extra arguments (beyond the named ones) CMake will store the extra +arguments in a list named ``ARGV``, and the count of the extra arguments in +``ARGN``. Below is a trivial example of providing a wrapper function for CMake's +built in function ``add_dependencies``. .. code-block:: cmake @@ -346,8 +349,7 @@ wrapper function for CMake's built in function ``add_dependencies``. This example defines a new macro named ``add_deps`` which takes a required first argument, and just calls another function passing through the first argument and -all trailing arguments. When variable arguments are present CMake defines them -in a list named ``ARGV``, and the count of the arguments is defined in ``ARGN``. +all trailing arguments. CMake provides a module ``CMakeParseArguments`` which provides an implementation of advanced argument parsing. We use this all over LLVM, and it is recommended |

