Help: Make SHELL option examples more generic

Comments at the bottom of the docs for add_compile_options() and
target_compile_options() recommend using other commands if setting
compiler definitions. Change the examples we use for the SHELL:
functionality to use -option instead of -D so that we don't violate our
own recommendations. This also makes the examples more
appropriate for use with link options as well.

Tweak the wording to not specify the type of option being discussed.
This will already be clear from the page the text is included into and
it avoids naming unrelated option types for the given page.
This commit is contained in:
Craig Scott 2021-05-15 16:23:54 +10:00
parent 639a6bd4c7
commit b20c1f4880

View File

@ -1,11 +1,12 @@
The final set of compile or link options used for a target is constructed by The final set of options used for a target is constructed by
accumulating options from the current target and the usage requirements of accumulating options from the current target and the usage requirements of
its dependencies. The set of options is de-duplicated to avoid repetition. its dependencies. The set of options is de-duplicated to avoid repetition.
.. versionadded:: 3.12 .. versionadded:: 3.12
While beneficial for individual options, the de-duplication step can break While beneficial for individual options, the de-duplication step can break
up option groups. For example, ``-D A -D B`` becomes ``-D A B``. One may up option groups. For example, ``-option A -option B`` becomes
specify a group of options using shell-like quoting along with a ``SHELL:`` ``-option A B``. One may specify a group of options using shell-like
prefix. The ``SHELL:`` prefix is dropped, and the rest of the option string quoting along with a ``SHELL:`` prefix. The ``SHELL:`` prefix is dropped,
is parsed using the :command:`separate_arguments` ``UNIX_COMMAND`` mode. and the rest of the option string is parsed using the
For example, ``"SHELL:-D A" "SHELL:-D B"`` becomes ``-D A -D B``. :command:`separate_arguments` ``UNIX_COMMAND`` mode. For example,
``"SHELL:-option A" "SHELL:-option B"`` becomes ``-option A -option B``.