Conan Add Remote 🆕 Top-Rated

Conan Add Remote 🆕 Top-Rated

Detailed Guide: conan add remote in Conan

Pattern 1: The "Hybrid" Model (Internal Cache + Conan Center)

This is the most common enterprise setup. You maintain an internal Artifactory that acts as a read/write cache in front of Conan Center.

Setup:

# 1. Add your internal remote as primary
conan remote add company https://artifactory.internal/ --insert 0

Why Use conan add remote?

Here are the three most common scenarios where you need to add a remote: conan add remote

  1. Accessing Private Libraries: Your company has proprietary libraries (e.g., authentication_lib, payment_gateway) that cannot be uploaded to Conan Center. You add a private remote hosted on your corporate server.
  2. Using a Different Package Channel: Certain organizations or open-source projects host their own Conan repositories for specific configurations (e.g., bleeding-edge builds, debug-only variants, or custom C++ standard flags).
  3. Faster Download Speeds: If your team is globally distributed, you might add a remote mirror closer to your geographic location to reduce latency.

A. Company-wide Binary Cache (Artifactory/CloudRepo)

Prevent each developer from building large libraries like Boost or Qt from source.

conan remote add corp-artifactory https://artifactory.corp.com/artifactory/api/conan/conan-local --insert 0

2. Command Syntax and Options

Basic syntax:

conan remote add <remote-name> <remote-url> [options]
  • <remote-name>: A unique, user-defined identifier for the remote (e.g., my_company, artifactory-dev).
  • <remote-url>: The URL of the Conan repository (must end with /v2 if using Conan V2 API, or /v1 for older servers).
  • [options]: Optional flags (see below).

4. Understanding Remote Priority

Order matters. When Conan looks for a package, it checks remotes in the order they appear in the list.

  • --insert 0 → highest priority
  • Without --insert → appended to the end → lowest priority

Check the current order:

conan remote list

Example output:

conancenter: https://center.conan.io [Verify SSL: True]
internal: https://my-internal-server.com/v2 [Verify SSL: True]
my_artifactory: https://mycompany.jfrog.io/artifactory/api/conan/conan-local [Verify SSL: True]

Understanding Conan Remotes: The "Git Analogy"

Before diving into the command itself, it's crucial to understand what a remote represents in Conan. Detailed Guide: conan add remote in Conan Pattern

Think of Conan remotes exactly like Git remotes. Just as git remote add origin https://github.com/user/repo.git links your local repository to a shared server, conan add remote links your local Conan cache to a Conan server. This server could be:

  • Conan Center: The official public repository (default remote).
  • JFrog Artifactory: A commercial or self-hosted solution.
  • Conan Server: The open-source, lightweight server.
  • A custom S3/WebDAV server: Any server implementing the Conan API.

When you run conan install, Conan searches your configured remotes in a specific order to find the recipe and binary packages for your dependencies. Without the correct remotes, your build will fail with a cryptic Unable to find 'openssl/1.1.1' in remotes error. When you run conan install