Conan is a package manager for C and C++ which aims to solve some very common and difficult challenges. Not all developers have used a package manager before, so let’s briefly explain what that means.First, the Conan package manager lets developers capture the artifacts which are created during builds of libraries and applications and store them as a “Conan Package”. This is often a combination of headers and libraries (static or dynamic), but can also include executables. Developers can then list the “Conan Packages” needed for other projects as “dependencies”, and Conan will pass all the artifacts to those projects as needed. With this strategy, package management with Conan provides a first-class mechanism for reusing code and sharing components across many projects. Finally, Conan has a server application upon which Conan repositories can be created. The Conan client can then upload and download Conan packages from these repositories, enabling developers to share packaged components among their teams, and across different development environments.
What are the benefits of using Conan?
Modern C and C++ software is very often developed as a collection of separate components, including libraries and applications. This usually includes a mix of open-source components, and private components. As a result, the process of building software becomes increasingly more difficult as the number of components in the project increases. Using a package manager such as Conan to define and maintain the relationships between these components makes building the build process much easier. It also enables powerful capabilities such as the ability to describe the build steps of each component in a universal format, as well as the ability to store and upload binaries which have been built to shared repositories.
Where can I get Conan packages?
ConanCenter is a public, moderated, central repository maintained by the Conan team which contains hundreds of popular open-source libraries and applications. This is the best place to find packages for open-source projects so that you don’t have to create them yourself. The recipes for these packages can be found at ConanCenterIndex.
Can I create my own Conan packages?
Most Conan users leverage it to create packages for their own components in addition to using it as a method for consuming open- source packages. You can quickly learn how to create your own recipes for Conan packages following the [instructions in the documentation]. Once you’ve created some packages of your own, you can also learn how to upload them to your own private Conan repositories.
Can Conan store/manage pre-compiled binaries?
Yes, one of Conan’s core features is its ability to store and manage pre-compiled binaries of libraries and applications. When a Conan package is used to build a library or application, it stores the binaries in a local cache. These binaries can be uploaded and shared via a remote Conan repository. In this way, any number of unique configurations can be built and stored within a single package, including different operating systems, compilers, compiler versions and architectures.
Can I Integrate my build system/tool with Conan?
Yes, Conan supports most popular C and C++ build systems out of the box, including CMake, Autotools, MSBuild, B2 and others. It is also extensible, enabling users to easily add support for custom or proprietary build systems, which are common in enterprise organizations. With Conan, you can build and package components regardless of what build system each component uses.
Can Conan manage different versions of the same library/package?
Yes, Conan has robust comprehension of versioning. with Conan, each version of each library or package is managed independently in the repository. Any number of versions can be stored in the local cache or remote repository at the same time, each with its own pre-built binaries. This is great when you have different applications which depend on different versions of the same library or package, or when you want to want to switch the version of a dependency for a given project. Both cases are trivial and fully supported.
Can I create my own private repository for hosting Conan packages?
Yes, Conan includes the ability to create and host private Conan repositories for sharing packages. JFrog’s “Artifactory” application is the premier enterprise repository hosting platform for Conan packages. Artifactory CE for C and C++ is a free edition, which is designed to provide the C and C++ developer community with the ability to create and host Conan repositories at no cost, and with the benefits of maturity and robustness of the Artifactory server application. JFrog also provides Artifactory hosted as a cloud service which Conan repositories can be created and hosted there as well.
What platforms can I use Conan with?
Conan is multi-platform. This means two things. First, it means that the Conan client can run on Linux, Windows, macOS, and anywhere else python can run. Second, it means that it can build and store packages for any platform. If you have a compiler or cross-compiler which can target a platform, Conan can store the binaries for it. Common examples include mobile platforms like Android and IOS, real- time hardware platforms, and embedded hardware platforms including bare-metal devices.
Is Conan Stable?
Yes. Conan maintains a strong commitment to stability. Packages built with a major version such as Conan 1.x will continue to work for all future Conan 1.x versions. If there’s a breaking change to the package model, it won’t happen until the next major Conan version is released (such as 2.x for example).
How is Conan licensed?
The Conan project is published with the very permissive MIT license.
How is the Conan project maintained?
JFrog Inc. maintains Conan with a dedicated full-time development team. This team includes the Conan founders, and several additional developers. The Conan team also has a formal community engagement and feedback strategy known as the Conan Tribe. The tribe is composed of over 70 volunteers from the Conan user community who have committed to providing input on major road map decisions whenever the Conan team requests it.
How active is the Conan project?
In addition to a team of full-time maintainers, Conan has a very active user community which submits dozens of pull requests each month. In 2020, Conan received over 3500 PRs in total. Also, the Conan slack channel has 1200 members, and is one of the most active channels in the C++ community.
What resources exist to help me learn Conan?
The Conan team has created multiple interactive, self-paced Conan training courses. These courses are all available completely free, courtesy of JFrog in the JFrog academy.