<div class="gmail_quote">Responses inline on this one...<br><br><br>On Wed, Nov 17, 2010 at 1:56 PM, David Doria <span dir="ltr">&lt;<a href="mailto:daviddoria@gmail.com">daviddoria@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div>The goal is simply this:</div>
</div><br>- given:<br>  -- an executable target, that happens to be a bundle app on the Mac<br>  -- a full path to that bundle in the install tree<br>  -- a list of plugins that you have also already installed in the bundle<br>


  -- a list of directories where to find libraries that your executables and plugins depend on<br><br>that the following CMake code:<br><br>install(CODE &quot;<br>   include(BundleUtilities)<br>   fixup_bundle(\&quot;${YOUR_BUNDLE_PATH}\&quot; \&quot;\${YOUR_PLUGINS}\&quot; \&quot;${YOUR_LIBRARY_DIRS}\&quot;)<br>


   &quot; COMPONENT Runtime)<br><br>will do all the analysis and copying and fixing up of dependent libraries that is mechanically possible...<br><br>So that you do not even have to mention VTK and Qt to your install rules at all.<br>


<br>If you have to say anything about VTK or Qt beyond target_link_libraries, then BundleUtilities is a failure.<br><br><br>David C.<br><br>
</blockquote></div><div><br></div></div><div>Ok, progress, and more questions:</div><div><br></div>1) I think it worked, check it out.:<br><div><a href="http://www.vtk.org/Wiki/CMake/CPack/BundleUtilities/Examples/Linux/Automatic" target="_blank">http://www.vtk.org/Wiki/CMake/CPack/BundleUtilities/Examples/Linux/Automatic</a></div>

<div><br></div><div>Though the .deb created is 37MB, where when I manually included vtkHybrid.a it was only 2MB...</div></blockquote><div><br>It should have a bunch of *.so files in it. And not a single *.a file. .a library files are not needed at runtime. BundleUtilities should only copy in runtime prerequisites into the target install directory.<br>
 <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><br></div><div>2) Do I need both the INSTALL(TARGETS... and INSTALL(CODE... ? Could these be combined into one command? It seems like there is a lot of duplication (I am specifying the executable twice, etc).</div>
</blockquote><div><br>You should use install(TARGETS for targets that you are building via add_executable or add_library.<br><br>You need the install(CODE for copying in prerequisites and doing fixups *after* the target has been installed, but still at install time.<br>
<br>So you have to reference some variables multiple times, but you should eliminate duplication by using variables that make sense for your situation.<br><br> <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<div><br></div><div>3) Is there a way to lose all the $,\, and &quot; in the syntax? That is, change:</div><div><br></div><div>fixup_bundle(\&quot;${APPS}\&quot; \&quot;\${YOUR_PLUGINS}\&quot; \&quot;${YOUR_LIBRARY_DIRS}\&quot;)</div>

<div><br></div><div>to:</div><div><br></div><div>fixup_bundle(${APPS} ${YOUR_PLUGINS} ${YOUR_LIBRARY_DIRS})</div><div><br></div><div>That would make it seem much easier to use, even if it really isn&#39;t any easier :)</div>
</blockquote><div><br>The escaped double quotes are necessary to get double quotes into the &quot;install(CODE&quot; that runs at install time. If you don&#39;t use them, then you can&#39;t have any spaces in any of the expanded variables. If you don&#39;t like them, write a *.cmake script and use install(SCRIPT instead of install(CODE.<br>
<br><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><br></div><div><a href="http://www.vtk.org/Wiki/CMake/CPack/BundleUtilities/Examples/Linux/Automatic" target="_blank"></a>4) I&#39;m still not sure what is going on with this business:</div><div><br></div><div><div>
    BUNDLE DESTINATION . COMPONENT Runtime</div>
<div>    RUNTIME DESTINATION bin COMPONENT Runtime</div><div><br></div><div>I think a definition of a &quot;bundle&quot; a &quot;destination&quot;, a &quot;component&quot; and &quot;runtime&quot; should be provided here: <a href="http://www.itk.org/Wiki/BundleUtilitiesExample" target="_blank">http://www.itk.org/Wiki/BundleUtilitiesExample</a></div>

<div><br></div></div></blockquote><div><br>If the CMake documentation (--help-command install) is unclear about these things, suggest improvements to the documentation. Why should those definitions be duplicated outside of the official CMake documentation built into the CMake code.....?<br>
<br>On the other hand, it&#39;s a wiki, so if adding definitions of those things makes the wiki page clearer to folks who first see it, then by all means, feel free to make such modifications.<br><br><br> <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><div></div><div>5) Why do you have to specify the Library_Dirs? Can&#39;t it just use the same list that it uses to look for vtkHybrid when I specify it in the target_link_libraries:</div><div><br></div><div>TARGET_LINK_LIBRARIES(VTKIncludeTest vtkHybrid)</div>
</div></blockquote><div><br>Because the fixup_bundle method is called as a cmake script at install time, and there may be additional locations besides your build tree where these prerequisites were built. For example, with Qt, if I build it on my Mac, I put it in a ~/Qt/4.x.x-arch folder -- this is not known to the cmake script that runs at install time unless you tell it, so we allow programmers to pass in additional search directories where these things may be found in case the build products do not reference them by full path.<br>
<br><br>HTH,<br>David C.<br><br><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div>
<div><br></div><font color="#888888">David</font></div>
</blockquote></div><br>