tags:

views:

111

answers:

1

Hello all,

I have a project whose artifacts are two dynamic libraries, let's say libX.dylib and libY.dylib (or .so for linux distributions). There are no executables.

Now I would like to distribute these libraries. Since I already use CMake to compile it, I looked at CPack and successfully generated .tgz and .deb packages for Linux. However, for Mac OSX I have no idea and the CPack Wiki about its generators did not help me much. I managed to generate a PackageMaker package, but as clearly stated at this packagemaker howto, there is no uninstall option when using this util. I then read a bit about Bundles, but I feel lost specially since I have no executable.

Question: What is the correct way to generate a package for Mac OSX using CPack?

My ideal scenario would be either something that installs as easily as a bundle or as a deb file in debian/ubuntu.

Thanks for your help

Edit One more detail: the code to one of these libraries is not open, so I can't expect the users to do a cmake; make; make install

That's why I want a .deb, .tar.gz, bundle or whatsoever.

+1  A: 

It depends on whether you want to install it the UNIX-y way (which is totally an ok thing to do, and actually my own preference as a Mac user) or if you want to install it as a Mac OS X Framework.

To install the libraries the UNIX-y way, you can use:

INSTALL(TARGETS target1 target2 DESTINATION lib)

In the above, replace target1 and target2 with the names of the targets that resulted in libX.dylib and libY.dylib being generated (i.e. whatever you used in ADD_LIBRARY). You can use the variable CMAKE_INSTALL_PREFIX in order to determine where the library ultimately ends up... with the above, if you set CMAKE_INSTALL_PREFIX to /usr/local, then it will install the libraries in /usr/local/lib

Edit
Based on your update, you may find Component Install with CPack and CPack Mac OS X PackageMaker Generator to be of interest. Since you will be installing libraries into the system, the PackageMaker generator is the one you should use. If you were merely distributing an application, then creating a ".app" bundle and distributing it in a ".dmg" would be the proper thing to do. PackageMaker is installed on Mac OS X when you install the Xcode Developer Tools. To package a ".app" bundle in a ".dmg", you can use the Mac OS X disk utility application or its associated commandline tools.

Michael Aaron Safyan
Actually, it's difficult to express myself in this situation. I am more interested in the distribution of the libraries. For example, for debian/ubuntu, I use a .deb generated by CMake/CPack (therefore I already use `INSTALL`), but I don't know what to do it in mac.
YuppieNetworking
Cool I didn't know the component install feature. Also, you are right, the packagemaker it's the way to go with libraries, as explained in http://developer.apple.com/mac/library/documentation/Porting/Conceptual/PortingUnix/distributing/distibuting.html ( I just found the link )... unfortunately, the uninstall option is still a wish
YuppieNetworking