# Latest version
pip install conan
# Previous versions
pip install -v "conan==1.59.0"(Unix) Prefer using virtual environment
virtualenvoversudo pip install conanfor installation.
- Remote repositories
# Add repository
conan remote add <repo_name> <repo_url>
# Authenticate for a remote
conan user <user_name> -p <password> -r <remote_name>
# List recipes in remote repo
conan search -r <remote_name>- Local cache
# List recipes in local cache
conan search# Install the dependencies (if exists any)
# Generates generator files e.g. conaninfo.txt/conanbuildinfo.txt
conan install .\conanfile.py -if .\build\ -pr .\conan\profiles\msvc_win.txt -s build_type=Release
# Build the package
## -if: directory where the generator files are at from previous step
conan build .\conanfile.py -if .\build\
# Since cmake_layout is used in conanfile, the expected cmake build folder is build and it is recommended to place generator files under build so install command uses build dir for install folder.
# Create package and expose it in the local cache.
conan export-pkg .\conanfile.py demo/testing --profile .\conan\profiles\msvc_win.txt -s build_type=Release -bf .\build\
# Test package
conan test .\test_package\ cpp_cmake_scaffold/0.1@demo/testing --build=never -pr .\conan\profiles\msvc_win.txt -s build_type=Release
-
Using
conanwithninjabuild tool:ninjacomplains aboutCMAKE_GENERATOR_PLATFORMbeing defined.- Make sure you're using
CMakeDepsand/orCMakeToolchaingenerators inconanfile.txtorconanfile.py. - Add
tools.cmake.cmaketoolchain:generator=Ninjato your profile txt file under `[conf]. - [Windows only] When you run
conan install ..for that profile, it will generateconanvcvars.batunder given directory for-ifargument. It is used for initializing the required environment forNinja.
Before applying step 4, run this
batfile from the command line to activate the environment.- Run
cmake . -B build -G Ninja ...and othercmakeorninjacommands.
- Make sure you're using
-
cmake_find_packagegenerator needs to be used with by settingCMAKE_MODULE_PATHandCMAKE_PREFIX_PATHas defined here and in audacity repo -
Host & Build Context