The list() command
This command provides basic operations on lists: reading, searching, modification, and ordering. Some modes will change list (mutate the original value). Be sure to copy the original value if you'll need it later.
Full details can be found in the online documentation:
https://cmake.org/cmake/help/latest/command/list.html
Reading
The following modes are available:
list(LENGTH <list> <out>)
counts the elements in the<list>
variable and stores the result in the<out>
variable.list(GET <list> <index>... <out>)
copies the<list>
elements specified with the list of<index>
indexes to the<out>
variable.list(JOIN <list> <glue> <out>)
interleaves<list>
elements with the<glue>
delimiter and stores the resulting string in the<out>
variable.list(SUBLIST <list> <begin> <length> <out>)
works like theGET
mode, but...