On Monday, August 01, 2011 07:12:15 pm Gregory Crosswhite wrote: > Hey everyone, > > I am using CMake to build a package which has the normal unix layout, > i.e. programs are in bin/, libraries are in lib/, etc., and I would like > to simply copy all of the required shared non-system libraries into lib/ > and make sure that the executable is updated to look for them there so > that I can have an standalone distribution. CMake *almost* supports > this with fixup_bundle, but unless I am missing something it doesn't > seem to give me any control as to where the shared libraries are > installed, and it doesn't update the executable except on OSX --- though > the latter is not a big deal since if I understand correctly I can just > add @executable_path@/../lib to the RPATH. Furthermore, on Linux it > incorrectly assumes that libraries in /usr/lib should be considered > system libraries (that is, guaranteed to be available everywhere), when > in fact only libraries in /lib should be, which means that I can't even > easily use get_prerequisites directly to find all of the libraries that > I need and then copy them to the correct location myself. > > (Of course, an alternative would be to just statically-link everything, > but frankly having searched around it looks like it is simply impossible > for me to force all non-system libraries to be statically linked, > especially since once of them is libgfortran which is included > automatically by the gfortran compiler and I can't figure out a good way > to get CMake to reliably link statically to libgfortran instead of > dynamically. If anyone has any recommendations on this front I would be > happy to hear them.) > > So anyway, at the moment to do what I want it looks like I would have to > make my own project-specific copies of GetPrerequisites.cmake and > BundleUtilities.cmake and then hack them up in order to force them to do > what I want. But I can't help but think that there must have lots of > people out there who have wanted to do what I want to do and so this > problem must have been solved in a much better way. So does anyone have > advice for a way to do what I want, i.e. an easy way to copy all > non-system libraries (where only /lib is interpreted to be the location > of system libraries) to a directory of my choosing relative to the > installation prefix and to modify the executable to make sure it finds > them? Or is my only option really to copy into my project and hack up > GetPrerequisites.cmake and BundleUtilities.cmake? >
You shouldn't need to copy GetPrerequisites and BundleUtilities. For Linux you can do: set_target_properties( ... PROPERTIES INSTALL_RPATH "\$ORIGIN/../lib") To get /usr/lib/ to be treated as non-system libraries, you can implement gp_resolved_file_type_override() to adjust that behavior. See gp_item_default_embedded_path() in GetPrerequisites for more information. And finally, to copy the dependents into lib/ instead of bin/, you can implement gp_item_default_embedded_path_override() to return a different path. See gp_resolved_file_type() in GetPrerequisites for more information. -- Clinton Stimpson Elemental Technologies, Inc Computational Simulation Software, LLC www.csimsoft.com _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
