<div>No, it wouldn't; check it out:<br></div>
<br>
% touch a<br>
% rm -f b<br>
% ls b<br>
ls: cannot access b: No such file or directory<br>
% cmake -E copy_if_different a b<br>
% ls b<br>
b<br>
% cksum a b<br>
4294967295 0 a<br><div>
4294967295 0 b<br></div><div><br></div><div>It works with one file, but I have 4 files that are generated.</div><div>I have 4 cmake -E copy_if_different commands, one for each file.</div><div>Only the last file is not copied (if similar). The others are copied </div>
<div>even if they are the same.</div><div><br></div><div>I verfied that they are the same with a diff.</div><div><br></div><div>Any idea what might be happening here ?</div><div><br></div><div>Thank You</div><div>Ajay</div>
<br><div class="gmail_quote">On Sat, Mar 3, 2012 at 2:47 PM, Michael Hertling <span dir="ltr"><<a href="mailto:mhertling@online.de" target="_blank">mhertling@online.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>On 03/03/2012 10:36 PM, Ajay Panyala wrote:<br>
> Try "cmake -E copy_if_different ..."<br>
><br>
> cmake -E copy_if_different build/test1.c build/tests/test1.c<br>
><br>
> That would work when make is run atleast once.<br>
> When running make for the 1st time test1.c was never<br>
> copied to build/tests before. So I would be comparing a file with<br>
> another non-existant file and that would result in an error halting<br>
> the make process.<br>
<br>
</div>No, it wouldn't; check it out:<br>
<br>
% touch a<br>
% rm -f b<br>
% ls b<br>
ls: cannot access b: No such file or directory<br>
% cmake -E copy_if_different a b<br>
% ls b<br>
b<br>
% cksum a b<br>
4294967295 0 a<br>
4294967295 0 b<br>
<br>
Regards,<br>
<font color="#888888"><br>
Michael<br>
</font><div><div><br>
> On Sat, Mar 3, 2012 at 1:20 PM, Hendrik Sattler <<a href="mailto:post@hendrik-sattler.de" target="_blank">post@hendrik-sattler.de</a>>wrote:<br>
><br>
>> Am Samstag, 3. März 2012, 21:41:49 schrieb Ajay Panyala:<br>
>>> I have a custom target which runs a command to generate<br>
>>> a C source file say test1.c<br>
>>><br>
>>> ADD_CUSTOM_TARGET(TestGen ALL<br>
>>> COMMAND genExec ${PROJECT_SOURCE_DIR}/Main.java<br>
>>> DEPENDS ${PROJECT_SOURCE_DIR}/Main.java<br>
>>> )<br>
>>><br>
>>> And I have a custom command that moves the generated *test1.c *<br>
>>> to a new directory inside the build directory.<br>
>>><br>
>>> ADD_CUSTOM_COMMAND(<br>
>>> TARGET TestGen<br>
>>> POST_BUILD<br>
>>> COMMAND mv<br>
>>> ARGS ${PROJECT_BINARY_DIR}/test1.c ${PROJECT_BINARY_DIR}/tests/<br>
>>> )<br>
>>><br>
>>> Each time I run make, the custom target is run (since custom targets are<br>
>>> always<br>
>>> out-of-date). But I want to avoid moving the new test1.c generated each<br>
>>> time if build/test1.c is the same as build/tests/test1.c since there are<br>
>>> other targets<br>
>>> like add_executable and add_library later in the CMakelists file that are<br>
>>> re-built<br>
>>> each time since they depend on test1.c<br>
>><br>
>> Try "cmake -E copy_if_different ..."<br>
>><br>
>> HS<br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</div></div></blockquote></div><br><br clear="all"><br><br>