Loops
Let's learn about the while and foreach loops in CMake.
We'll cover the following...
Loops in CMake are fairly straightforward – we can use either while() or foreach() to repeatedly execute the same set of commands. Both of these commands support loop control mechanisms: 
- The - break()loop stops the execution of the remaining block and breaks from the enclosing loop.
- The - continue()loop stops the execution of the current iteration and starts at the top of the next one.
The while() loop 
The loop block is opened with a while() command and closed with an endwhile() command. ...
 Ask