On Tue, May 28, 2013 at 1:07 PM, Matthew Woehlke <matthew.woeh...@kitware.com> 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. >
I would add a minor note; this seems to be a good way, but you don't really need to delete the temp file, if you build it in the ${CMAKE_BINARY_DIR}, so it's not laying around in source trees. It would be nice if such a simple thing didn't require launching a seperate instance of cmake to do; since it's already in cmake, would think there would be a way to just 'EXEC( ... )' instead of 'cmake -E (...)' > -- > Matthew > > -- > > 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 -- 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