[Cmake] FILE command

Brad King brad . king at kitware . com
Fri, 18 Jul 2003 08:19:44 -0400 (EDT)


> and would allow looping over a file extracting lines and getting info
> FILE(READ filename ABIGSTRING)
> STRING(NUMBEROFLINES ABIGSTRING line0)
> STRING(LINE 0 ABIGSTRING line0)
> STRING(LINE 1 ABIGSTRING line1)

If the file doesn't have semicolons in it, then you can do this right now:

FILE(READ foo.txt CONTENTS)
STRING(REGEX REPLACE "\n" ";" SPLIT "${CONTENTS}")
FOREACH(line ${SPLIT})
  # use ${line}
ENDFOREACH(line)

-Brad