[CMake] Writing a list variable to file

Ian.Appru at ubs.com Ian.Appru at ubs.com
Wed Mar 1 07:52:49 EST 2006


Hi,

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?

I tried various solutions and the code below works but is extremely slow
~1min to write 700 lines!
>FOREACH(VAR ${ALL_VALS})
>	FILE(APPEND my-file.txt "${VAR}\r")
>ENDFOREACH(VAR)

I made a tweak to cmFileCommand.cxx so that the WRITE cmd looks for the
extra variable "LIST"
So
>WRITE(APPEND LIST my-file.txt ${ALL_VALS}) 

will output a list like 
aaa
bbb
ccc
rather than aaa;bbb;ccc

It takes a more acceptable 1/2 second to do so.

I would prefer to use the std cmake functionality than my homegrown
version - is there a method of doing this I've missed?

I'm using a cvs cmake version 2.3-20060222

Regards
Ian


Visit our website at http://www.ubs.com

This message contains confidential information and is intended only 
for the individual named.  If you are not the named addressee you 
should not disseminate, distribute or copy this e-mail.  Please 
notify the sender immediately by e-mail if you have received this 
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free 
as information could be intercepted, corrupted, lost, destroyed, 
arrive late or incomplete, or contain viruses.  The sender therefore 
does not accept liability for any errors or omissions in the contents 
of this message which arise as a result of e-mail transmission.  If 
verification is required please request a hard-copy version.  This 
message is provided for informational purposes and should not be 
construed as a solicitation or offer to buy or sell any securities or 
related financial instruments.
-------------- next part --------------
Skipped content of type multipart/mixed


More information about the CMake mailing list