DCPACK_COMPONENTS_ALL = "SomeLibrary some-application" \ $ cmake -G Ninja - DCMAKE_BUILD_TYPE = Release \ $ cd /path /to /cmake -cpack -example /build ![]() To check what components will get packed, you can print the CPACK_COMPONENTS_ALL variable: ![]() I don’t quite understand, what is going on here, but that’s how it worked for me. ) the COMPONENT value should go right after EXPORT, otherwise it kind of doesn’t apply or applies to something else?. It is important that in case of install(TARGETS. # these are cache variables, so they could be overwritten with -D, I put all that into a separate CMake module in the project ( /cmake/Packing.cmake): Then you just include a standard module named CPack into your project. So if you already have installation instructions in your project, then there is not much left for you to do.Īs a bare minimum, you need to set some variables for CPack, such as package name and the way you’d like components to be ( or not to be) grouped. Most of the work is done by install() statements. Let’s take the same project that was used as an example in the C library article, but make it slightly more complex: now it will have one more library ( just to increase the number of components in the project, the main application doesn’t even link to it).įor the reference, full project source code is available here. Additional complexity of the task was that I needed to make a package only for that library and not for the entire SDK. In my case I needed to make a deb package for one of the libraries of our SDK, so deb package format will be the main focus of this article. Instead of dealing with every single package format structure and requirements “manually”, you can let CPack handle all of them, so you’ll only need to worry about getting the actual package contents together. Quite often it’s just a ZIP archive, but it can be also something more sophisticated, such as a package in one of the package management system formats, such as NuGet, RPM, deb and so on.ĬPack comes especially handy if you need to support more than one package format. The package is simply a “distribution unit” - something that you share with your users, or, in other words, what form your library/SDK/application is delivered in. While CMake handles building the project, CPack is responsible for making packages. ![]() This time I was tasked with creating a deb package for one of the libraries in our SDK.Īnd what would you know, CMake can handle packaging too - with CPack utility.ĬPack, like CMake itself, is a CLI program. Last time I needed to handle a C library project with CMake.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |