I first need to mention that deploying libraries, especially if multiplatform support is it be considered, is a huge topic that could be approached in many different ways. Let’s forget about Config files and find_package for a moment and see how to add the most basic installation support. Find modules and Config files can be consumed with the help of the find_package command – it will find the Find module or Config file associated with the given package and process them, thus making targets they define available. Both of these are a standard way of exposing targets that encapsulate all the necessary information to the user. In CMake all this is handled by Find modules, or the more recent Config files. However, it’s not quite sufficient for binaries – it could be used to download the package, but what then? We still need the information about include and link paths, possibly defines, flags and transitive dependencies. It’s a great solution for including dependencies that need to be built alongside the project. In part 6 I introduced the FetchContent module. In the context of CMake this would mean supporting the standard ways of incorporating dependencies into a project. This may be somewhat vague, but the key point, I believe, is the convenience. “Deployment of the binaries, be it static or shared, and possibly header files – for development purposes, to a directory of user’s choosing, in a way that exposes the binaries, headers and potential information about transitive dependencies, for convenient consumption by depending projects.” In the latter case, it will always be a shared library.Ī practical definition for “installing a library” could then be something along the lines of In the former case, the library could be either static or shared. It could be a development (build) dependency, or it could be runtime dependency. A library will generally be a dependency of another project – either a larger library or an application. What does it mean to “install” a library? Let’s first consider how a library is used. In this part of the series, we take a closer look at installing libraries. No matter if you’re working on a library or an executable application, users need to be able to deploy the binaries to a location of their choosing in a reliable way. The next step is providing support for deploying, or installing, the built binaries to our users. In the previous part of the series, we looked at how to add tests to a project.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |