开发者

What would be the best way to install (distribute) dynamic libraries in Mac OSX using CMake/Cpack?

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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜