If I were to try to do this *after* calling add_executable() or add_library(), would it be easier to obtain?<br><br><div class="gmail_quote">On Wed, Jun 20, 2012 at 12:54 PM, Thompson, K T <span dir="ltr"><<a href="mailto:kgt@lanl.gov" target="_blank">kgt@lanl.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d">Robert,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d">I’m not sure this is exactly what you are looking for, but you may be able to use “generator expressions.” See the documentation for add_custom_command for more
details, but basically you can use the expression $<TARGET_FILE:foo> to retrieve the executable name generated by target ‘foo’. I think this only works after you use add_executable( foo ${src} ).<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d">-kt<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> <a href="mailto:cmake-bounces@cmake.org" target="_blank">cmake-bounces@cmake.org</a> [mailto:<a href="mailto:cmake-bounces@cmake.org" target="_blank">cmake-bounces@cmake.org</a>]
<b>On Behalf Of </b>Robert Dailey<br>
<b>Sent:</b> Wednesday, June 20, 2012 11:41 AM<br>
<b>To:</b> CMake ML<br>
<b>Subject:</b> Re: [CMake] How to get target binary name?<u></u><u></u></span></p>
</div>
</div><div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal" style="margin-bottom:12.0pt">Another note: This has to work the same for both release and debug, and for both visual studio and makefile generators.<u></u><u></u></p>
<div>
<p class="MsoNormal">On Wed, Jun 20, 2012 at 12:40 PM, Robert Dailey <<a href="mailto:rcdailey.lists@gmail.com" target="_blank">rcdailey.lists@gmail.com</a>> wrote:<u></u><u></u></p>
<p class="MsoNormal">I'm looking for the quickest and most natural way to get the final binary name of a target, ideally before add_executable() or add_library() is called (not sure if this is possible).<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">For example, if my executable target's output is fubar.exe, I want to get "fubar.exe" in a variable.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Any examples? Thanks.<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div></div></div>
</div>
</div>
</blockquote></div><br>