[CMake] Iterating empty elements in a list

Robert Dailey rcdailey.lists at gmail.com
Tue Aug 6 16:04:42 EDT 2013


I've seen that list(LENGTH) will ignore empty elements in a list. Example:

1;2;;4;5

Length will be 4 here instead of 5. I was trying to come up with a way
to modify the list as a string prior to iterating it to give empty
elements some dummy value, so that the above example would appear as:

1;2;<empty>;4;5

However, this isn't going to work with string( REGEX REPLACE ) as the
modifications are not included in the continuation of the regex search
(I think positive lookbehind is needed here?). Basically this case
cannot be converted:

;;;

to:

<empty>;<empty>;<empty>

Anyone know how I can iterate empty elements in a list?


More information about the CMake mailing list