[CMake] Writing a list variable to file
Brad King
brad.king at kitware.com
Wed Mar 1 09:13:24 EST 2006
Ian.Appru at ubs.com wrote:
> Is there a recommended way of writing a variable containing a list to a
> file - so that each ; sep item ends up on a different line?
There are several approaches. Here are two:
1.) Build the contents of the variable with newlines instead of
semicolons, or transform the contents like this:
SET(CONTENTS "")
FOREACH(line MYLINES)
SET(CONTENTS "${CONTENTS}${line}\n")
ENDFOREACH(line)
2.) Use the STRING command's REGEX option to replace semicolons with
newlines.
-Brad
More information about the CMake
mailing list