[CMake] Generating source files..

Dekeyser, Kris Kris.Dekeyser at lms.be
Wed May 25 03:20:54 EDT 2005


Hi,

IMO CONFIGURE_FILE should be able to do what you want. You could even create a template that contains nothing but one variable and have it replaced by CONFIGURE_FILE with the source code body of several lines. I'm not sure if there is a limit to the number of characters and/or lines that can be in the replacement variable, but I'm using this technique to create files of 10 to 20 lines in size wthout problems.

The CMakeLists.txt will then create the file when the Makefile/Solution is created. If you want to create a source file when you run make, a CUSTOM_COMMAND should be appropriate. You would then need to create a small program that creates the source code.

> -----Original Message-----
> From: Shishir Ramam [mailto:sramam at gmail.com]
> Sent: Wednesday, May 25, 2005 01:11
> To: cmake at www.cmake.org
> Subject: [CMake] Generating source files..
> 
> 
> Hi, 
> 
> I'm trying to find a way to generate a source file from a 
> CMakeLists file. 
> WRITE_FILE is not allowed. CONFIGURE_FILE only does
> a file copy. 
> 
> It would be good to be able to generate the source file from the 
> CMakeLists.txt, since it allows greater control over what the 
> source is.
> Also, this has the positive effect of keeping all related code in a
> single file.
> 
> Actually on thinking about this, not sure why this should result in 
> an infinite loop. Perhaps someone in the know can explain?
> 
> thanks,
> -shishir
> 
> -- 
> The man who doesn't read good books has no advantage over the man who
> can't read them. - Mark Twain
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
> 
+-+-+- Email Confidentiality Footer +-+-+- 
Privileged/Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such person), you may not print, retain, copy nor disseminate this message or any part of it to anyone and you should notify the sender by reply email and destroy this message. Neglecting this clause could be a breach of confidence. Please advise immediately if you or your employer does not consent to Internet email for messages of this kind. Opinions, conclusions and other information in this message that are not related to the official business of my firm shall be understood as neither given nor endorsed by it.


More information about the CMake mailing list