Add support for configure_file to take a string as CONTENT rather than an input file, similar to file(GENERATE)
I couldn't find an existing bug report on this, but maybe I missed it.
I think it would be useful to allow creating a file at configure time from a string.
The current situation for creating files is:
file(WRITE content)
- written at configure time, overrides content always, takes a string
configure_file(input_file output_file)
- written at configure time, doesn't override content unless changed, takes an input file
file(GENERATE INPUT input-file | CONTENT content)
- written at generation time, doesn't override content unless changed, takes either an input file or a string
I think it would be useful to add a
configure_file(OUTPUT output-file CONTENT content)
- writes at configure time, doesn't override content unless changed, takes a string
Or perhaps it should be called file(CONFIGURE OUTPUT output-file CONTENT content)
?
The use case is to create a file at configure time from a string, and not override it when the content hasn't changed. Using current configure_file() with an input file is clunky because if you would like to add it to a public macro / function you are shipping, it means you need to make sure to install the cmake.in file as well.
Thoughts?