<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 3/28/2019 4:12 PM, Kyle Edwards
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:1553803922.3145.10.camel@kitware.com">
<div>One more thing: if you want the custom target to be built by
"make" or "make all", you have to give it the ALL argument:</div>
<div><br>
</div>
<div><span style="font-family: 'Ubuntu Mono'; font-size: 17px;">add_custom_target(mygeneratedtarget
ALL</span><br style="font-family: 'Ubuntu Mono'; font-size:
17px;">
<span style="font-family: 'Ubuntu Mono'; font-size: 17px;">
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/mygeneratedfile</span><br
style="font-family: 'Ubuntu Mono'; font-size: 17px;">
<span style="font-family: 'Ubuntu Mono'; font-size: 17px;">)</span></div>
<div><br>
</div>
<div>Otherwise you can build the target with "make
mygeneratedtarget".</div>
<div><br>
</div>
</blockquote>
<p>OK! That does make a difference. I had focused on the
add_custom_target documentation that indicated the rule was always
considered out of date, and jumped to the conclusion that that
meant it was always run.</p>
<p>Thank you for sorting that out!<br>
</p>
<p>What I find surprising is that 'make install' could not identify
how to create mygeneratedfile. Is there some reason why
'mygeneratedfile' cannot be a target in its own right with needing
to refer to this phony target to achieve the desired result?</p>
<p>Related to that, I noticed in another thread the mention of
'CMAKE_SKIP_INSTALL_ALL_DEPENDENCY'. If that were set in this
case, how could I indicate that install depends on
mygeneratedtarget? (Admittedly, I'm having a hard time coming up
with a case where this would apply, but I'm having trouble with
the tenuous connection between the instruction to install
mygeneratedfile and the rule that actually generates it.)<br>
</p>
</body>
</html>