mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-22 14:23:10 -05:00
@@ -151,6 +151,79 @@ REMOVE_DUPLICATES
|
||||
|
||||
Removes duplicated items in the list.
|
||||
|
||||
TRANSFORM
|
||||
"""""""""
|
||||
|
||||
::
|
||||
|
||||
list(TRANSFORM <list> <ACTION> [<SELECTOR>]
|
||||
[OUTPUT_VARIABLE <output variable>])
|
||||
|
||||
Transforms the list by applying an action to all or, by specifying a
|
||||
``<SELECTOR>``, to the selected elements of the list, storing result in-place
|
||||
or in the specified output variable.
|
||||
|
||||
.. note::
|
||||
|
||||
``TRANSFORM`` sub-command does not change the number of elements of the
|
||||
list. If a ``<SELECTOR>`` is specified, only some elements will be changed,
|
||||
the other ones will remain same as before the transformation.
|
||||
|
||||
``<ACTION>`` specify the action to apply to the elements of list.
|
||||
The actions have exactly the same semantics as sub-commands of
|
||||
:command:`string` command.
|
||||
|
||||
The ``<ACTION>`` may be one of:
|
||||
|
||||
``APPEND``, ``PREPEND``: Append, prepend specified value to each element of
|
||||
the list. ::
|
||||
|
||||
list(TRANSFORM <list> <APPEND|PREPEND> <value> ...)
|
||||
|
||||
``TOUPPER``, ``TOLOWER``: Convert each element of the list to upper, lower
|
||||
characters. ::
|
||||
|
||||
list(TRANSFORM <list> <TOLOWER|TOUPPER> ...)
|
||||
|
||||
``STRIP``: Remove leading and trailing spaces from each element of the
|
||||
list. ::
|
||||
|
||||
list(TRANSFORM <list> STRIP ...)
|
||||
|
||||
``GENEX_STRIP``: Strip any
|
||||
:manual:`generator expressions <cmake-generator-expressions(7)>` from each
|
||||
element of the list. ::
|
||||
|
||||
list(TRANSFORM <list> GENEX_STRIP ...)
|
||||
|
||||
``REPLACE``: Match the regular expression as many times as possible and
|
||||
substitute the replacement expression for the match for each element
|
||||
of the list
|
||||
(Same semantic as ``REGEX REPLACE`` from :command:`string` command). ::
|
||||
|
||||
list(TRANSFORM <list> REPLACE <regular_expression>
|
||||
<replace_expression> ...)
|
||||
|
||||
``<SELECTOR>`` select which elements of the list will be transformed. Only one
|
||||
type of selector can be specified at a time.
|
||||
|
||||
The ``<SELECTOR>`` may be one of:
|
||||
|
||||
``AT``: Specify a list of indexes. ::
|
||||
|
||||
list(TRANSFORM <list> <ACTION> AT <index> [<index> ...] ...)
|
||||
|
||||
``FOR``: Specify a range with, optionaly, an incerment used to iterate over
|
||||
the range. ::
|
||||
|
||||
list(TRANSFORM <list> <ACTION> FOR <start> <stop> [<step>] ...)
|
||||
|
||||
``REGEX``: Specify a regular expression. Only elements matching the regular
|
||||
expression will be transformed. ::
|
||||
|
||||
list(TRANSFORM <list> <ACTION> REGEX <regular_expression> ...)
|
||||
|
||||
|
||||
Sorting
|
||||
^^^^^^^
|
||||
|
||||
|
||||
Reference in New Issue
Block a user