[CMake] Turning a string into a list.

James Bigler bigler at cs.utah.edu
Thu Oct 11 09:12:22 EDT 2007


Try SEPARATE_ARGUMENTS.

SET(Q "one;two;three")
SEPARATE_ARGUMENTS(Q)
FOREACH(I ${Q})
   MESSAGE("I = ${I}")
ENDFOREACH(I)

On Oct 11, 2007, at 6:42 AM, Josef Karthauser wrote:

> Does anyone know how to turn a string, such as "one;two;three" into a
> list, so that I can enumerate the elements in a list?
>
> I want something like:
>
> 	SET(Q "one;two;three")
> 	FOREACH(I TO_LIST(Q))
> 		...
> 	ENDFOREACH().
>
> Thanks,
> Joe
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list