...

/

The list() Command

The list() Command

Let's learn about the list() command in CMake.

This command provides basic operations on lists:

  • Reading

  • Searching

  • Modification

  • Ordering

Some modes will change the list (mutate the original value). Be sure to copy the original value if we'll need it later. Full details can be found in the online documentation.

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>... ...