[CMake] write file if different?

j s j.s4403 at gmail.com
Wed May 29 14:44:02 EDT 2013


On Wed, May 29, 2013 at 2:32 AM, Michael Wild <themiwi at gmail.com> wrote:
>
> On 28.05.2013 22:07, Matthew Woehlke wrote:
> > Is there a built-in way to write a string to a file (a la FILE(WRITE))
> > that will only write the file if the content would be different? (Or
> > does FILE(WRITE) already work this way despite no obvious hint in the
> > documentation that it does?)
> >
> > Right now I am writing to a temporary file and running cmake -E
> > copy_if_different, then removing the temporary file, but this seems
> > inelegant and I am wondering if there is a better solution.
> >
You can always use the rsync command, which is available for all
systems, including Windows.


>
> AFAIK the file is written unconditionally, but you can then use
> configure_file(... COPYONLY) instead of a round-about execute_process()
> that calls cmake -E copy_if_different.
>
> Michael
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list