On Tuesday 21 August 2007 11:10, Dizzy wrote:
> Hello
>
> Short version:
> Is there some built-in support in cmake for string replacement in files (ie
> to generate a file from another by replacing a given string with another,
> similar to configure_file() but more general) and could this string
> replacement operation be used as a "command" for add_custom_command() ?

You can read a file using FILE (READ) and then replace stuff using 
STRING(REPLACE) and STRING(REGEX REPLACE) and write it using FILE(WRITE).
If you really need to do this from a custom command you have to put these 
commands in an extra cmake script and call this one using ${CMAKE_COMMAND} -P 
<your cmake script>, probably you need to add something like -DFILENAME=<your 
file name> before the -P to set some variables which will be needed in the 
script.

Why do you need this from add_custom_command() ?
I would suggest using plain configure_file().

>
> Long version:
> I have recently started to test a cmake based build system for one of my
> projects. I am interested in cmake mostly because currently we have to deal
> with autotools for Unices (which even works for exotic ones such as BeOS)

CMake should also work on BeOS (not sure how many active cmake users there 
are).

Bye
Alex
_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to