[CMake] Reading the content of a file

Timo Rumland cr at olympclan.de
Sun Feb 25 08:07:18 EST 2007


Hello,

> Have you tried CONFIGURE_FILE() ? You can use it to replace
> variables.
> CONFIGURE_FILE(myfile ${CMAKE_CURRENT_BINARY_DIR}/myfile-copy)

I can use CONFIGURE_FILE to copy the file, but I have to edit the
content of the file (that goes beyond just replacing VARS in the
file).

I must use a regex to do a string replace. The STRING function can do
this, but only on variables, not files. So I have to read a file into
a variable, change the variable with STRING and finally write it out
into a new file.

Timo




More information about the CMake mailing list