<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Oct 7, 2019 at 11:21 PM Setzer Sebastian (CM-CI2/ECS2) <<a href="mailto:Sebastian.Setzer@de.bosch.com">Sebastian.Setzer@de.bosch.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">Hi Craig,<br>
<br>
On Mon, 7. Oct 2019 12:56 Craig Scott wrote:<br>
> As it happens, I just updated the docs for these in the last day or so.<br>
<br>
You mean you updated the docs of the two commands, but you did not update the docs of the DEPENDS parameter, right?<br></blockquote><div><br></div><div>Yes, sorry if that was only partially related to your original query. Fred's follow-up makes it clearer that the wording of a few sections for these two commands probably need some improvement (that will be separate to the merge request I linked to).</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">> There is a difference between the two, but it's subtle and specific to the sort of scenario I mentioned in that issue comment.<br>
<br>
So the manual for the DEPENDS parameter of add_custom_target is outdated, but fixing it is not as easy as copying it from add_custom_command.<br></blockquote><div><br></div><div>I'll defer a response on whether it is outdated or not, but I would expect different text to be required for the two commands because they do have different behaviours.</div><div><br></div><div> </div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
From: Craig Scott <<a href="mailto:craig.scott@crascit.com" target="_blank">craig.scott@crascit.com</a>> <br>
Sent: Montag, 7. Oktober 2019 12:56<br>
To: Setzer Sebastian (CM-CI2/ECS2) <<a href="mailto:Sebastian.Setzer@de.bosch.com" target="_blank">Sebastian.Setzer@de.bosch.com</a>><br>
Cc: <a href="mailto:cmake@cmake.org" target="_blank">cmake@cmake.org</a><br>
Subject: Re: [CMake] DEPENDS parameter of add_custom_target<br>
<br>
<br>
<br>
On Mon, Oct 7, 2019 at 9:32 PM Setzer Sebastian (CM-CI2/ECS2) via CMake <mailto:<a href="mailto:cmake@cmake.org" target="_blank">cmake@cmake.org</a>> wrote:<br>
Dear list,<br>
The manual says:<br>
<a href="https://cmake.org/cmake/help/latest/command/add_custom_target.html" rel="noreferrer" target="_blank">https://cmake.org/cmake/help/latest/command/add_custom_target.html</a><br>
Reference files and outputs of custom commands created with add_custom_command() command calls in the same directory (CMakeLists.txt file). They will be brought up to date when the target is built.<br>
Use the add_dependencies() command to add dependencies on other targets.<br>
<br>
This is different from what the manual of add_custom_command says, and would be surprising for all users who only read the manual of add_custom_command and then think they know what the parameter means for add_custom_target.<br>
<br>
But on the other hand, when I test with this:<br>
--------------------------------------------------<br>
cmake_minimum_required (VERSION 3.14)<br>
project(dependency_test LANGUAGES)<br>
<br>
add_custom_target(T1<br>
                  COMMAND echo T1<br>
                  )<br>
add_custom_target(T2<br>
                  COMMAND echo T2<br>
                  DEPENDS T1<br>
                  )<br>
<br>
# cmake -GNinja -B build .<br>
# ninja T2<br>
--------------------------------------------------<br>
Then T1 and T2 are built, so contrary to what the manual says, it seems to work.<br>
<br>
Is the manual just outdated (Maybe behavior has changed and only manual for add_custom_command has been updated)?<br>
Should it be the same as for add_custom_command, or are there really some differences?<br>
<br>
As it happens, I just updated the docs for these in the last day or so. You can find it in the not-yet-merged merge request here:<br>
<br>
<a href="https://gitlab.kitware.com/cmake/cmake/merge_requests/3891" rel="noreferrer" target="_blank">https://gitlab.kitware.com/cmake/cmake/merge_requests/3891</a><br>
<br>
I wrote an explanation of the specific behavior of the dependencies in the associated issue here:<br>
<br>
<a href="https://gitlab.kitware.com/cmake/cmake/issues/19771#note_635547" rel="noreferrer" target="_blank">https://gitlab.kitware.com/cmake/cmake/issues/19771#note_635547</a><br>
<br>
There is a difference between the two, but it's subtle and specific to the sort of scenario I mentioned in that issue comment.<br></blockquote><div> </div></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Craig Scott<br><div>Melbourne, Australia</div><div><a href="https://crascit.com" target="_blank">https://crascit.com</a><br></div><div><br></div><div>Get the hand-book for every CMake user: <a href="https://crascit.com/professional-cmake/" target="_blank">Professional CMake: A Practical Guide</a><br></div><div>Consulting services (CMake, C++, build/release processes): <a href="https://crascit.com/services" target="_blank">https://crascit.com/services</a></div></div></div></div></div></div></div></div></div></div></div></div>