Skip to content

Instantly share code, notes, and snippets.

@YanzhaoW
Last active November 12, 2025 12:57
Show Gist options
  • Select an option

  • Save YanzhaoW/369f2c46b806353cf81c08d4062fa6aa to your computer and use it in GitHub Desktop.

Select an option

Save YanzhaoW/369f2c46b806353cf81c08d4062fa6aa to your computer and use it in GitHub Desktop.
Conan: C++ package manager

Installation

Conan can be installed via pip, or any python package manager, such as miniforge3:

conda install conan

Main documentation site: https://docs.conan.io/2/

Searching for packages

Check conan center: https://conan.io/center

Configurations

Profiles

[settings]
arch=x86_64
build_type=RelWithDebInfo
compiler=gcc
compiler.cppstd=gnu20
compiler.libcxx=libstdc++11
compiler.version=12
os=Linux

[conf]
tools.cmake.cmaketoolchain:generator=Ninja

Command lines

conan install . --output-folder=./build --build=missing --settings=build_type=RelWithDebInfo

Through Conan-CMake

  1. Go to the conan cmake-wrapper github repo: https://github.com/conan-io/cmake-conan
  2. Use git submodule to include the cmake-wrapper inside your project:
git submodule add https://github.com/conan-io/cmake-conan.git cmake-conan
  1. Run cmake:
cmake -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=cmake-conan/conan_provider.cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -GNinja -B=build .

It seems that this command only succeeds when running inside the project root directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment