[CMake] Mac Bundle installation with libraries

James Bigler jamesbigler at gmail.com
Fri Feb 26 15:24:30 EST 2010


How is that?  Could you provide a brief example of which function to call?
I looked through the code and wasn't sure what I could call since almost all
the copies are done using execute_process which runs at configure time.

James

On Fri, Feb 26, 2010 at 1:12 PM, Clinton Stimpson <clinton at elemtech.com>wrote:

>
> Using BundleUtilities.cmake on each of the bundles should copy that library
> into each bundle.
>
> Clint
>
> On Friday 26 February 2010 11:02:12 am James Bigler wrote:
> > I have a project that builds a group of mac bundles that depend on a
> >  library I also compile.  I need to install the library within the bundle
> >  to get it to be relocatable, but I have no way of doing this without
> >  creating a circular dependency.
> >
> > src/CMakeLists.txt:
> >
> > add_subdirectory(mylib)
> > add_subdirectory(mysamples)
> >
> > src/mylib/CMakeLists.txt:
> >
> > add_library(mylib mylib.cpp mylib.h)
> > set_target_properties(mylib PROPERTIES VERSION "2.3.4" SOVERSION "1")
> > install(TARGETS mylib RUNTIME DESTINATION bin LIBRARY DESTINATION lib
> > ARCHIVE DESTINATION lib)
> >
> > src/mysamples/CMakeLists.txt:
> >
> > foreach(sample fun lessfun)
> >   add_executable(${sample} ${sample}.cpp MACOSX_BUNDLE)
> >   target_link_libraries(${sample} mylib)
> >
> >   install(TARGETS ${sample} DESTINATION samples)
> >   # I really want to install mylib in the bundle, but I don't have access
> >  to the library target anymore.
> >   install(TARGETS mylib DESTINATION samples/${sample}.app/Contents/MacOS)
> > endforeach()
> >
> > I really want to install my library within the bundle, but I don't have
> > access to the library outside of the mylib subdirectory.  I can't create
> > install targets in the mylib install directory, because I don't have the
> > list of bundles to install it to until after I parse the mysamples
> >  directory and it's too late.
> >
> > I tried to use the LOCATION_${CMAKE_BUILD_CONFIG} variable, but because
> I'm
> > using the VERSION and SOVERSION properties on my library I only get one
> of
> > the symlinks and not all three (libmylib.dylib -> libmylib.2.3.4.dylib,
> > libmylib.1.dylib -> libmylib.2.3.4.dylib, and libmylib.2.3.4.dylib).
> >
> > Is there some way I can get mylib to also install with my executable
> > bundles?
> >
> > James
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100226/a316314f/attachment.htm>


More information about the CMake mailing list