Commit Graph

16 Commits

Author SHA1 Message Date
Craig Scott
2000abe74f
Help: Recommend good prefixes for cmake_parse_arguments, expand example
Fixes: #25773
2024-08-31 18:33:14 +10:00
Craig Scott
bb37d0e1a5
Help: Improve grammar and wording for cmake_parse_arguments 2024-08-31 18:10:32 +10:00
Craig Scott
ceeea4e511
cmake_parse_arguments: Set variable if empty string given after keyword
If a single-value keyword is followed by an empty string, the
command unsets the variable for that keyword instead of setting
it to the empty string. This is inconsistent and unexpected. Add
policy CMP0174 which ensures the variable for a single-value
keyword is always set when any value is given, not just for a
non-empty value.

The new CMP0174 policy only affects the PARSE_ARGV form of
cmake_parse_arguments. The older form silently drops all empty
string arguments before processing the argument list.

Fixes: #25972
2024-08-23 09:42:13 +10:00
Alex Turbov
65457e4fae
Help: Add _See Also_ sections to related CMake commands 2022-11-09 23:52:30 +04:00
Nikita Nemkin
05c3060b10 Help: Fix cmake_parse_arguments version note
Don't imply that cmake_parse_arguments() requires CMake 3.5+.
2020-12-02 21:00:28 +05:00
Nikita Nemkin
a19058d7d8 Help: Replace some versionadded directives with versionchanged
`.. versionchanged` directive might be more appropriate when
documentation refers to previous CMake version, old behavior
or a policy, and there's no new parameter or a variable involved.

Issue: #19715
2020-11-12 09:44:01 +05:00
Nikita Nemkin
c705279bae Help: Add .. versionadded directives to commands documentation
This change ony concerns directives that appear in the document body.

The guidelines for inserting version directives:

 * Baseline version is CMake 3.0, i.e. directives start at 3.1.
 * Always use `.. versionadded::` directive, avoid ad-hoc version
   references. Exception: policy pages.
 * For new command signatures, put `versionadded` on a separate line
   after the signature.
 * For a group of new signatures in a new document section,
   a single version note at the beginning of the section is sufficient.
 * For new options, put `versionadded` on a separate line before
   option description.
 * If all the option descriptions in the list are short one-liners,
   it's fine to put `versionadded` on the same line as the description.
 * If multiple option descriptions in close proximity would have
   the same ..versionadded directive, consider adding a single
   directive after the list, mentioning all added options.
 * For compact value lists and sub-option lists, put a single
  `versionadded` directive after the list mentioning all additions.
 * When a change is described in a single paragraph, put
   `versionadded` into that paragraph.
 * When only part of the paragraph has changed, separate the changed
   part if it doesn't break the flow. Otherwise, write a follow-up
   clarification paragraph and apply version directive to that.
 * When multiple version directives are close by, order earlier
   additions before later additions.
 * Indent related lists and code blocks to include them in the scope
   of `versionadded` directive.

Issue: #19715
2020-11-09 20:51:57 +05:00
Kitware Robot
496ec6036f Help: Add Sphinx 'versionadded' directives to each top-level document
Run the `Utilities/Sphinx/update_versions.py` script to add initial
markup to every top-level document and find module.

Issue: #19715
2020-07-06 10:23:20 -04:00
Craig Scott
264612c013 Help: Typo and grammar fixes in cmake_parse_arguments() docs 2019-06-23 21:10:16 +10:00
Torsten Robitzki
5228432b45 cmake_parse_arguments: add KEYWORDS_MISSING_VALUES
Add KEYWORDS_MISSING_VALUES output variable to cmake_parse_arguments() to
allow to detect keywords that received no values.

Fixes: #18706
2019-02-07 12:59:10 -05:00
Joachim Wuttke (l)
c2efb3efcd Help: Revise docs on Scripting Commands
Revise docs for all "Scripting Commands", except four find_XXX
that use a macro suite of their own.

* Take full advantage of the improved syntax highlighting.
* Make consequential use of <..> placeholders.
* Clarify things here and there in the text.

Specific improvements to some command docs:

* "math": Correct description of novel hexadecimal capability.
* "if", "foreach", "while": Provide link to "endif" etc
* "foreach", "while": Mention "break" and "continue".
* "foreach": Simplify explanation of ``RANGE`` and ``IN`` signatures;
   advise against negative arguments or reverse ranges (compare issue #18461)
* "endif", "endfunction" etc: Explain that the argument is optional and
   maintained for compatibility only
2018-10-23 15:12:10 +02:00
Kai Wolf
b95eda9b11 Help: Fix code example in cmake_parse_arguments.rst 2018-02-04 08:41:03 +01:00
Sylvain Joubert
546a328978 Help: Fix cmake_parse_arguments behavior for not found arguments
Value keywords are actually UNDEFINED rather than set to the empty
string when they are not found in the argument list.
2017-10-20 09:05:13 +02:00
Bill Hoffman
cb299acc27 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>
2016-09-08 11:33:46 -04:00
Matthias Maennich
ab8a280857 cmake_parse_arguments: consider duplicate keyword as warning
The behaviour of double specified keywords is rather undefined or at
least not clearly documented. This change introduces a strict check and
emits a warning in case a keyword has been specified more than once.
2015-12-17 10:45:19 -05:00
Matthias Maennich
e8b148318f CMakeParseArguments: replace by native cmake_parse_arguments command
Implement a native `cmake_parse_arguments` command that is fully
compatible with the documented behaviour of the previous implementation.
Leave the CMakeParseArguments module empty but existing for
compatibility.
2015-12-17 10:44:28 -05:00