On 2013-05-30 12:11, j s wrote:
On Wed, May 29, 2013 at 11:14 PM, [email protected] wrote:
"j s" 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?)
You can always use the rsync command, which is available for all
systems, including Windows.
That's probably the worst possible solution... CMake has everything that iy
required to accomplish this built-in, so adding a unnecessary dependency
that is only needed by the build system is a really bad idea...
You are entitled to your opinion, but there are several system
utilities that are available by default on many systems, including
rsync.
Really? I have yet to encounter a Windows system that has rsync "by
default". (For that matter, even on Linux it is not required, and I
wouldn't put a lot of faith in finding it on a 'stock' non-Linux/BSD
UNIX platform.)
Besides, using rsync for a single file where cmake -E copy_if_different
(or even configure_file as elsewhere mentioned) is clearly overkill. Not
to mention that rsync is not guaranteed to be present even on UNIX
systems, much less Windows, whereas CMake is already being used.
The way CMake does things is often kludgy and just feels wrong. I
often write scripts in more effective languages and then run from
within CMake on Windows, Linux, and Mac OS X. Perl and Python are
often a much better way to go than trying to do everything in CMake.
Sure, and where a) it makes sense and b) I *already require the relevant
tools for other reasons*, I do also. But I try to avoid it, because
these dependencies are usually NOT present on Windows, especially for
end users that want to build from a tarball. (Which is why, when I wrote
test discovery for gtest, I did it in pure CMake. It may not be the
easiest/cleanest, but I strongly prefer to avoid large external
dependencies without much stronger motivation for needing them.)
--
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