list — CMake 3.23.0-rc4 Documentation
cmake.org › cmake › helpA list in cmake is a ; separated group of strings. To create a list the set command can be used. For example, set (var a b c d e) creates a list with a;b;c;d;e, and set (var "a b c d e") creates a string or a list with one item in it. (Note macro arguments are not variables, and therefore cannot be used in LIST commands.)
foreach - Looping over a string list - Stack Overflow
stackoverflow.com › questions › 24986392Jul 28, 2014 · I would like to loop over list of items, given in a string. As required by CMake, the items are separated by semicolons. The following. cmake_minimum_required (VERSION 2.8) FOREACH (LETTER "a;b;c") MESSAGE ("<<$ {LETTER}>>") ENDFOREACH () interpretes the string "a;b;c" as string literal. In contrast, when assigning "a;b;c" to a variable first, all works out as expected.
CMake Lists - Jeremi Mucha
jeremimucha.com › 2021 › 03Mar 15, 2021 · This isn’t a post about foreach, so I won’t go into too much detail. But the command offers some choices. The most obvious one is to just iterate element-wise over the list: foreach(elem ${my_list}) # use elem here endforeach() or. foreach(elem IN LISTS my_list other_list) # use elem here endforeach() This is straightforward.
foreach — CMake 3.23.0-rc2 Documentation
cmake.org › cmake › helpThe foreach command iterates over each list simultaneously setting the iteration variables as follows: if the only loop_var given, then it sets a series of loop_var_N variables to the current item from the corresponding... if multiple variable names passed, their count should match the lists ...