### Clone Example Sources Source: https://docs.conan.io/2/examples/tools/google/bazeltoolchain/build_simple_bazel_project.html Clone the example repository to follow along with the Bazel project setup. ```bash $ git clone https://github.com/conan-io/examples2.git $ cd examples2/examples/tools/google/bazeltoolchain/6_x/string_formatter ``` -------------------------------- ### Zypper Install Substitutes Example Source: https://docs.conan.io/2/reference/tools/system/package_manager.html Demonstrates how to use `install_substitutes` with Zypper to install packages, providing alternative package names for different distribution versions. ```python Zypper.install_substitutes(["libxcb-util-dev"], ["libxcb-util0-dev"]) ``` -------------------------------- ### Clone Example Repository Source: https://docs.conan.io/2/ci_tutorial/project_setup.html Clone the examples2 repository and navigate to the CI game directory to begin the tutorial setup. ```bash $ git clone https://github.com/conan-io/examples2.git $ cd examples2/ci/game ``` -------------------------------- ### PacMan Install Substitutes Example Source: https://docs.conan.io/2/reference/tools/system/package_manager.html Demonstrates how to use `install_substitutes` with PacMan to install packages, providing alternative package names for different distribution versions. ```python PacMan.install_substitutes(["package-name-lib32"], ["package-name-lib64"]) ``` -------------------------------- ### Conan Install Output Example Source: https://docs.conan.io/2/tutorial/consuming_packages/use_tools_as_conan_packages.html Observe the output of the `conan install` command, which details the dependency graph computation, package installation, and generator execution. ```text -------- Computing dependency graph ---------- cmake/3.27.9: Not found in local cache, looking in remotes... cmake/3.27.9: Checking remote: conancenter cmake/3.27.9: Trying with 'conancenter'... Downloading conanmanifest.txt Downloading conanfile.py cmake/3.27.9: Downloaded recipe revision 3e3d8f3a848b2a60afafbe7a0955085a Graph root conanfile.txt: /Users/user/Documents/developer/conan/examples2/tutorial/consuming_packages/tool_requires/conanfile.txt Requirements zlib/1.3.1 - Cache Build requirements cmake/3.27.9 - Downloaded (conancenter) -------- Computing necessary packages ---------- Requirements zlib/1.3.1:2a823fda5c9d8b4f682cb27c30caf4124c5726c8 - Cache Build requirements cmake/3.27.9:f2f48d9745706caf77ea883a5855538256e7f2d4 - Download (conancenter) -------- Installing packages ---------- Installing (downloading, building) binaries... cmake/3.27.9: Retrieving package f2f48d9745706caf77ea883a5855538256e7f2d4 from remote 'conancenter' Downloading conanmanifest.txt Downloading conaninfo.txt Downloading conan_package.tgz Decompressing conan_package.tgz cmake/3.27.9: Package installed f2f48d9745706caf77ea883a5855538256e7f2d4 cmake/3.27.9: Downloaded package revision 6c519070f013da19afd56b52c465b596 zlib/1.3.1: Already installed! -------- Finalizing install (deploy, generators) ---------- conanfile.txt: Generator 'CMakeToolchain' calling 'generate()' conanfile.txt: Generator 'CMakeDeps' calling 'generate()' conanfile.txt: Generating aggregated env files ``` -------------------------------- ### Execute a specific binary with dependencies Source: https://docs.conan.io/2/reference/commands/run.html This example shows how to run the 'openssl --version' command, ensuring that the 'openssl/3.5.4' package and its dependencies are installed and available. ```bash $ conan run "openssl --version" --tool-requires=openssl/3.5.4 Installing and building dependencies, this might take a while... OpenSSL 3.5.4 30 Sep 2025 (Library: OpenSSL 3.5.4 30 Sep 2025) ``` -------------------------------- ### Install System Packages with Apt Source: https://docs.conan.io/2/reference/conanfile/methods/system_requirements.html Example of using the Apt helper within system_requirements() to install development libraries. Ensures the system package manager is updated before installation. ```python from conan import ConanFile from conan.tools.system.package_manager import Apt class OpenCV(ConanFile): name = "opencv" version = "4.0" def system_requirements(self): apt = Apt(self) apt.install(["libgtk-3-dev"], update=True, check=True) ``` -------------------------------- ### Example conan install commands Source: https://docs.conan.io/2/reference/tools/apple/xcodetoolchain.html Run 'conan install' with different build types to generate corresponding .xcconfig files for Xcode. ```bash $ conan install conanfile.py # default is Release $ conan install conanfile.py -s build_type=Debug ``` -------------------------------- ### Clone Examples and Navigate Source: https://docs.conan.io/2/tutorial/developing_packages/editable_packages.html Clone the examples repository and navigate to the editable_packages directory to begin the tutorial. ```bash $ git clone https://github.com/conan-io/examples2.git $ cd examples2/tutorial/developing_packages/editable_packages ``` -------------------------------- ### Cloning the examples repository Source: https://docs.conan.io/2/tutorial/consuming_packages/intro_to_versioning.html Clone the examples repository to follow along with the versioning tutorial. ```bash git clone https://github.com/conan-io/examples2.git cd examples2/tutorial/consuming_packages/versioning ``` -------------------------------- ### Clone Example Project Source: https://docs.conan.io/2/tutorial/creating_packages/add_dependencies_to_packages.html Clone the example project from GitHub to follow along with the tutorial. Navigate into the specific directory for this example. ```bash $ git clone https://github.com/conan-io/examples2.git $ cd examples2/tutorial/creating_packages/add_requires ``` -------------------------------- ### Install Configuration from URL Source: https://docs.conan.io/2/reference/commands/config.html Installs configuration files from a zip archive located at a given URL. ```bash $ conan config install http://url/to/some/config.zip ``` -------------------------------- ### Global Configuration Example Source: https://docs.conan.io/2/reference/config_files/profiles.html Example of defining configuration lists in global.conf. ```ini # Defining several lists user.myconf.build:ldflags=["--flag1 value1"] user.myconf.build:cflags=["--flag1 value1"] ``` -------------------------------- ### Clone Example Project Source: https://docs.conan.io/2/tutorial/consuming_packages/different_configurations.html Clone the example project from GitHub to follow along with the tutorial. ```bash git clone https://github.com/conan-io/examples2.git cd examples2/tutorial/consuming_packages/different_configurations ``` -------------------------------- ### Clone Example Repository Source: https://docs.conan.io/2/tutorial/creating_packages/other_types_of_packages/header_only_packages.html Clone the example repository to follow along with the header-only package tutorial. ```bash git clone https://github.com/conan-io/examples2.git cd examples2/tutorial/creating_packages/other_packages/header_only ``` -------------------------------- ### Cloning Example Sources Source: https://docs.conan.io/2/examples/conanfile/layout/conanfile_in_subfolder.html Clone the example sources from GitHub to recreate the project structure. ```bash git clone https://github.com/conan-io/examples2.git cd examples2/examples/conanfile/layout/conanfile_in_subfolder ``` -------------------------------- ### Example Multi-Product Build Order Source: https://docs.conan.io/2/ci_tutorial/products_pipeline/multi_product.html Demonstrates the order of building binaries for different products and configurations, prioritizing the 'products' repository. ```bash # NOTE: The products repo is first, it will have higher priority. Then, after all binaries of `engine/1.0` have been built, it is possible to proceed to build the different binaries for `game/1.0`. It also contains 2 different binaries for its debug and release configurations, which can be built in parallel. In practice, this would mean something like: ``` -------------------------------- ### Run Project Setup Script Source: https://docs.conan.io/2/ci_tutorial/project_setup.html Execute the Python script to initialize the project, clean server repositories, create initial binaries, and upload them. ```bash $ python project_setup.py ``` -------------------------------- ### Example of applying options to all contexts Source: https://docs.conan.io/2/reference/commands/workspace.html This example shows how to apply a specific option to all contexts (host, build, and all). Use this when a configuration needs to be consistent across all build environments. ```bash conan workspace complete -o="pkg/*:with_qt=True" ``` -------------------------------- ### Example Conan Install Output Source: https://docs.conan.io/2/tutorial/consuming_packages/build_simple_cmake_project.html This output shows the process of Conan installing the Zlib library and generating toolchain and dependency files for CMake. It details dependency graph computation, package installation, and generator execution. ```bash $ conan install . --output-folder=build --build=missing ... -------- Computing dependency graph ---------- zlib/1.3.1: Not found in local cache, looking in remotes... zlib/1.3.1: Checking remote: conancenter zlib/1.3.1: Trying with 'conancenter'... Downloading conanmanifest.txt Downloading conanfile.py Downloading conan_export.tgz Decompressing conan_export.tgz zlib/1.3.1: Downloaded recipe revision f1fadf0d3b196dc0332750354ad8ab7b Graph root conanfile.txt: /home/conan/examples2/tutorial/consuming_packages/simple_cmake_project/conanfile.txt Requirements zlib/1.3.1#f1fadf0d3b196dc0332750354ad8ab7b - Downloaded (conancenter) -------- Computing necessary packages ---------- Requirements zlib/1.3.1#f1fadf0d3b196dc0332750354ad8ab7b:cdc9a35e010a17fc90bb845108cf86cfcbce64bf#dd7bf2a1ab4eb5d1943598c09b616121 - Download (conancenter) -------- Installing packages ---------- Installing (downloading, building) binaries... zlib/1.3.1: Retrieving package cdc9a35e010a17fc90bb845108cf86cfcbce64bf from remote 'conancenter' Downloading conanmanifest.txt Downloading conaninfo.txt Downloading conan_package.tgz Decompressing conan_package.tgz zlib/1.3.1: Package installed cdc9a35e010a17fc90bb845108cf86cfcbce64bf zlib/1.3.1: Downloaded package revision dd7bf2a1ab4eb5d1943598c09b616121 -------- Finalizing install (deploy, generators) ---------- conanfile.txt: Generator 'CMakeToolchain' calling 'generate()' conanfile.txt: Generator 'CMakeDeps' calling 'generate()' conanfile.txt: Generating aggregated env files ``` -------------------------------- ### Generate AutotoolsToolchain scripts Source: https://docs.conan.io/2/reference/tools/gnu/autotoolstoolchain.html Example of how to install and source the generated AutotoolsToolchain scripts in different operating systems. ```bash $ conan install conanfile.py # default is Release $ source conanautotoolstoolchain.sh # or in Windows $ conanautotoolstoolchain.bat ``` -------------------------------- ### Build 'hello' Consumer Application (Windows) Source: https://docs.conan.io/2/tutorial/developing_packages/editable_packages.html Build the 'hello' consumer application on Windows, demonstrating how it transparently consumes the 'say' package in editable mode for both Release and Debug configurations. ```bash $ cd ../hello # Windows: we will build two configurations to show multi-config $ conan install . -s build_type=Release $ conan install . -s build_type=Debug $ cmake --preset conan-default $ cmake --build --preset conan-release $ cmake --build --preset conan-debug $ build\Release\hello.exe say/1.0: Hello World Release! ... $ build\Debug\hello.exe say/1.0: Hello World Debug! ... ``` -------------------------------- ### Example Project Structure Source: https://docs.conan.io/2/tutorial/creating_packages/other_types_of_packages/package_prebuilt_binaries.html Illustrates the directory structure for pre-built binaries, organized by OS and architecture, including include and library files. ```tree . ├── conanfile.py └── vendor_hello_library ├── linux │   ├── armv8 │   │   ├── include │   │   │   └── hello.h │   │   └── libhello.a │   └── x86_64 │   ├── include │   │   └── hello.h │   └── libhello.a ├── macos │   ├── armv8 │   │   ├── include │   │   │   └── hello.h │   │   └── libhello.a │   └── x86_64 │   ├── include │   │   └── hello.h │   └── libhello.a └── windows ├── armv8 │   ├── hello.lib │   └── include │   └── hello.h └── x86_64 ├── hello.lib └── include └── hello.h ``` -------------------------------- ### Access Patch Version Digit Source: https://docs.conan.io/2/reference/tools/scm/version.html Get the patch version component, usually for bug fixes. This example shows how to extract it. ```python v = Version("1.2.3.4-alpha.3+b1") assert str(v.patch) == "3" ``` -------------------------------- ### Example usage of fix_apple_shared_install_name in conanfile Source: https://docs.conan.io/2/reference/tools/apple/other.html Demonstrates how to integrate the fix_apple_shared_install_name tool within the package() method of a Conan recipe, typically after installing with Autotools. ```python from conan.tools.apple import fix_apple_shared_install_name class HelloConan(ConanFile): ... def package(self): autotools = Autotools(self) autotools.install() fix_apple_shared_install_name(self) ``` -------------------------------- ### Using android_abi() in a Conanfile Source: https://docs.conan.io/2/reference/tools/android.html Example of how to import and use the `android_abi` function within a Conanfile's `generate` method to get the host ABI. ```python from conan.tools.android import android_abi class Pkg(ConanFile): def generate(self): abi = android_abi(self) ``` -------------------------------- ### Clone Example Sources Source: https://docs.conan.io/2/tutorial/creating_packages/handle_sources_in_packages.html Clone the example sources from the specified GitHub repository to follow along with the tutorial. Navigate into the downloaded directory. ```bash git clone https://github.com/conan-io/examples2.git cd examples2/tutorial/creating_packages/handle_sources ``` -------------------------------- ### Create and install package and application Source: https://docs.conan.io/2/tutorial/versioning/version_ranges.html Commands to remove existing packages, create a new version of 'pkg', and install 'app' to observe its dependency. ```bash $ conan remove "pkg*" -c $ conan create pkg --version=1.0 ... pkg/1.0 ... $ conan install app ... Requirements pkg/1.0 ``` -------------------------------- ### Install and Setup Conan with Audit Token Source: https://docs.conan.io/2/integrations/github.html This snippet shows how to install and set up the Conan client in a GitHub Actions workflow, including configuring an audit token for vulnerability scanning. It's useful for setting up CI/CD pipelines that require Conan package management and security checks. ```yaml name: Nightly security scan on: schedule: - cron: "0 0 * * *" jobs: scan-vulnerabilities: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Install and setup Conan uses: conan-io/setup-conan@v1 with: audit_token: ${{ secrets.MY_CONAN_AUDIT_TOKEN }} - name: Scan for vulnerabilities with Conan Audit run: | conan audit scan . ``` -------------------------------- ### Cloning the Example Project Source: https://docs.conan.io/2/examples/tools/cmake/cmake_toolchain/extend_own_cmake_presets.html Clone the example project from GitHub to follow along with the demonstration. Navigate into the cloned directory to access the project files. ```bash $ git clone https://github.com/conan-io/examples2.git $ cd examples2/examples/tools/cmake/cmake_toolchain/extend_own_cmake_presets ``` -------------------------------- ### Conan Server Configuration with Docker Ports Source: https://docs.conan.io/2/reference/conan_server.html Example server.conf snippet for a Dockerized Conan server setup. It specifies the public port that clients will use to connect. ```ini [server] ssl_enabled: False port: 9300 public_port: 9999 host_name: localhost ``` -------------------------------- ### Generate and Source AutotoolsDeps scripts Source: https://docs.conan.io/2/reference/tools/gnu/autotoolsdeps.html Example of how to install dependencies and then source the generated AutotoolsDeps script in a shell environment. This makes the dependency flags available to the build system. ```bash $ conan install conanfile.py # default is Release $ source conanautotoolsdeps.sh # or in Windows $ conanautotoolsdeps.bat ``` -------------------------------- ### Clone the example repository Source: https://docs.conan.io/2/examples/cross_build/toolchain_packages.html Clone the example repository to access the toolchain package sources. Navigate to the toolchain directory to begin. ```bash git clone https://github.com/conan-io/examples2.git cd examples2/examples/cross_build/toolchain_packages/toolchain ``` -------------------------------- ### Filter Files with .conanignore Source: https://docs.conan.io/2/reference/commands/config.html Example of a .conanignore file using fnmatch patterns to exclude files during configuration installation. The '*' pattern ignores all files, and '!' can be used to negate exclusions. ```bash # Ignore all files * ``` -------------------------------- ### fetch_packages() Source: https://docs.conan.io/2/reference/extensions/python_api/ConfigAPI.html Gets and downloads configuration packages into the Conan cache without installing them in the current Conan home. Primarily used for experimental commands like "conan lock upgrade-config". ```APIDOC ## fetch_packages() ### Description Gets and downloads configuration packages into the Conan cache, without installing such configuration in the current Conan home. This shouldn’t be necessary for regular Conan configuration, and used at the moment exclusively for the “conan lock upgrade-config” experimental command. ### Method POST (conceptual) ### Endpoint (Not applicable, this is an SDK method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **requires** (list) - Required - The package requirements to fetch. * **lockfile** (string) - Optional - Lockfile to be used to constrain and lock the versions and recipe-revisions from the input requirements, to the exact versions and revisions specified in the lockfile. * **remotes** (list) - Optional - Remotes to look for the configuration package. * **profile** (string) - Optional - If specified, use that profile to resolve for profile-specific different configurations, like depending on different settings. ### Returns None ``` -------------------------------- ### Initial build output Source: https://docs.conan.io/2/examples/conanfile/layout/editable_components.html Illustrates the output when building 'app' with only the 'hello' component linked. ```bash $ conan build app hello: Release! bye: Release! ``` -------------------------------- ### Checking Shared Library Install Names on macOS Source: https://docs.conan.io/2/reference/tools/gnu/autotools.html This example shows how to use the otool command to inspect the install_name of shared libraries on macOS, which is relevant when using the Autotools build helper for macOS builds. ```bash $ otool -l path/to/libMyLib.dylib ... cmd LC_ID_DYLIB cmdsize 48 name path/to/libMyLib.dylib (offset 24) time stamp 1 Thu Jan 1 01:00:01 1970 current version 1.0.0 compatibility version 1.0.0 ... Load command 11 cmd LC_LOAD_DYLIB cmdsize 48 name path/to/dependency.dylib (offset 24) time stamp 2 Thu Jan 1 01:00:02 1970 current version 1.0.0 compatibility version 1.0.0 ... ``` -------------------------------- ### Install Configuration from URL with Source and Target Folders Source: https://docs.conan.io/2/reference/commands/config.html Installs configuration files from a zip archive, extracting a specific folder ('origin') and placing it into a target folder ('target') in the local cache. ```bash $ conan config install http://url/to/some/config.zip -sf=origin -tf=target ``` -------------------------------- ### Filter graph info by options and package name Source: https://docs.conan.io/2/reference/commands/graph/info.html Use '--filter' and '--package-filter' to retrieve specific information like options for packages matching a pattern. The example shows how to get options for 'zlib' packages. ```bash $ conan graph info --require=binutils/2.38 -r=conancenter --filter=options --package-filter="zlib*" ``` -------------------------------- ### Clone Example Sources Source: https://docs.conan.io/2/tutorial/creating_packages/other_types_of_packages/tool_requires_packages.html Clone the example sources from the examples2 repository on GitHub to follow along with the tutorial. Navigate to the specific tool requires package directory. ```bash git clone https://github.com/conan-io/examples2.git cd examples2/tutorial/creating_packages/other_packages/tool_requires/tool ``` -------------------------------- ### Build and Run Example Application Source: https://docs.conan.io/2/examples/security/sanitizers.html Commands to build the C++ example using the configured Conan profile and then execute the compiled application. The output will show the AddressSanitizer status and any runtime errors detected by UBSan. ```bash cd signed_integer_overflow/ conan build . -pr ../profiles/gcc_asan_ubsan build/Debug/signed_integer_overflow ``` -------------------------------- ### Report System Requirements (Install Mode) Source: https://docs.conan.io/2/reference/conanfile/methods/system_requirements.html Command to report system requirements in 'install' mode using 'conan install'. This checks and lists packages that need to be installed, without actually installing them if 'tools.system.package_manager:mode' is set to 'report'. ```bash # Assuming apt is the default or using explicitly # -c tools.system.package_manager:tool=apt-get $ conan install . --format=json ``` -------------------------------- ### Cloning the examples repository Source: https://docs.conan.io/2/examples/tools/scm/git/capture_scm/git_capture_scm.html Clone the examples repository to access the Git SCM capture example. ```bash git clone https://github.com/conan-io/examples2.git cd examples2/examples/tools/scm/git/capture_scm ``` -------------------------------- ### Install Packages with Apt Source: https://docs.conan.io/2/reference/tools/system/package_manager.html Installs a list of packages using the apt-get command. Supports updating the package database, checking for existing installations, and handling host package installations during cross-building. ```python Apt.install_packages(packages=["package1", "package2"], update=True, check=True, recommends=False, host_package=True) ``` -------------------------------- ### Create a Sample Library Source: https://docs.conan.io/2/examples/cross_build/android/ndk.html Use the `conan new` command to generate a basic C++ library project for testing. ```bash $ conan new cmake_lib -d name=hello -d version=1.0 ``` -------------------------------- ### Clone Conan Examples Repository Source: https://docs.conan.io/2/examples/tools/files/patches/patch_sources.html Clone the necessary example repository to follow along with the patching examples. ```bash git clone https://github.com/conan-io/examples2.git cd examples/tools/files/patches ``` -------------------------------- ### Install Packages with Chocolatey Source: https://docs.conan.io/2/reference/tools/system/package_manager.html Installs a list of packages. Can optionally update the package database and check for existing installations first. ```python Chocolatey.install(packages=["package-name"], update=True, check=True) ``` -------------------------------- ### Clone Examples Repository Source: https://docs.conan.io/2/examples/dev_flow/debug/step_into_dependencies.html Clone the examples repository to access the source code for the tutorial. This is the first step to setting up your project for debugging. ```bash git clone https://github.com/conan-io/examples2.git cd examples2/tutorial/consuming_packages/simple_cmake_project ``` -------------------------------- ### Install Packages with Apt Source: https://docs.conan.io/2/reference/tools/system/package_manager.html Installs a list of packages. Can optionally update the package database and check for existing installations first. ```python Apt.install(packages=["package-name"], update=True, check=True) ``` -------------------------------- ### Install Packages with Apt Source: https://docs.conan.io/2/reference/tools/system/package_manager.html Installs a list of specified packages. Can optionally update the package database and check for existing installations. ```python Apt.install(["package1", "package2"], update=True, check=True) ``` -------------------------------- ### Example of creating and inspecting a package Source: https://docs.conan.io/2/reference/commands/cache.html Demonstrates the process of creating a new library package and then inspecting its exported recipe path in the Conan cache. ```bash $ conan new cmake_lib -d name=pkg -d version=0.1 $ conan create . ... Requirements pkg/0.1#cdc0d9d0e8f554d3df2388c535137d77 - Cache Requirements pkg/0.1#cdc0d9d0e8f554d3df2388c535137d77:2401fa1d188d289bb25c37cfa3317e13e377a351 - Build $ conan cache path pkg/0.1 /p/5cb229164ec1d245/e $ ls /p/5cb229164ec1d245/e conanfile.py conanmanifest.txt $ conan cache path pkg/0.1#latest /p/5cb229164ec1d245/e # The recipe revision might be different in your case. # Check the "conan create" output to get yours $ conan cache path pkg/0.1#cdc0d9d0e8f554d3df2388c535137d77 /p/5cb229164ec1d245/e $ conan cache path pkg/0.1 --folder=export_source /p/5cb229164ec1d245/es $ ls /p/5cb229164ec1d245/es CMakeLists.txt include/ src/ $ conan cache path pkg/0.1 --folder=source /p/5cb229164ec1d245/s $ ls /p/5cb229164ec1d245/s CMakeLists.txt include/ src/ ``` -------------------------------- ### Apache Configuration for Pip Installation Source: https://docs.conan.io/2/reference/conan_server.html Use this Apache configuration when Conan is installed via pip. Ensure mod_wsgi is installed. ```apache WSGIScriptAlias / /usr/local/lib/python3.6/dist-packages/conans/server/server_launcher.py WSGICallableObject app WSGIPassAuthorization On Require all granted ``` -------------------------------- ### Cloning Example Sources Source: https://docs.conan.io/2/tutorial/creating_packages/configure_options_settings.html Clone the example sources for this tutorial from GitHub. Navigate to the specific directory for the tutorial. ```bash git clone https://github.com/conan-io/examples2.git cd examples2/tutorial/creating_packages/configure_options_settings ``` -------------------------------- ### Example of applying settings to all contexts Source: https://docs.conan.io/2/reference/commands/workspace.html This example demonstrates applying a compiler setting to all contexts. This is useful for ensuring a consistent compiler is used throughout the build process. ```bash conan workspace complete -s="compiler=gcc" ``` -------------------------------- ### Install Packages with System Package Manager Source: https://docs.conan.io/2/reference/tools/system/package_manager.html Installs a list of packages using the system's package manager. Optionally updates the package database and checks if packages are already installed. Can install for the host architecture when cross-building. ```python conan.tools.system.package_manager.install(packages, update=False, check=True, host_package=True) ``` -------------------------------- ### install Source: https://docs.conan.io/2/reference/tools/cmake/cmake.html Performs the installation step, equivalent to running `cmake --install`. Supports specifying build type, component, and arguments. ```APIDOC ## install(_build_type = None, _component = None, _cli_args = None, _stdout = None, _stderr = None, _subfolder = None_) ### Description Equivalent to running `cmake --install`. Allows specifying the component to install and overriding the build type. ### Parameters * **build_type** (str) - Overrides `settings.build_type`. May fail for single-configuration generators. * **component** (str) - The specific component to install, if any. * **cli_args** (list) - List of arguments for the underlying build system passed to `cmake --install ...`. * **subfolder** (str) - Experimental: Subfolder within `build_folder` and `package_folder`. Defaults to root. * **stdout** (stream) - Stream to redirect stdout to. * **stderr** (stream) - Stream to redirect stderr to. ``` -------------------------------- ### Test Package Example Usage Source: https://docs.conan.io/2/examples/graph/tool_requires/using_protobuf.html This C++ example demonstrates how to call the `myaddresser()` function from the library, verifying that the integration with Protobuf works correctly. ```cpp #include #include #include #include "myaddresser.h" int main(int argc, char* argv[]) { myaddresser(); return 0; } ``` -------------------------------- ### Test Conan Installation Source: https://docs.conan.io/2/installation.html After installing Conan, run this command to verify the installation and see the available Conan commands and their help information. ```bash conan ``` -------------------------------- ### Clone Example Sources Source: https://docs.conan.io/2/tutorial/creating_packages/package_method.html Clone the example sources from GitHub to follow along with the tutorial. Navigate to the specific package method directory. ```bash git clone https://github.com/conan-io/examples2.git cd examples2/tutorial/creating_packages/package_method ``` -------------------------------- ### Install Packages with Pkg Source: https://docs.conan.io/2/reference/tools/system/package_manager.html Installs a list of specified packages using Pkg. Can optionally update the package database and check for existing installations. ```python Pkg.install(["package1", "package2"], update=True, check=True) ``` -------------------------------- ### Install Packages with Brew Source: https://docs.conan.io/2/reference/tools/system/package_manager.html Installs a list of specified packages using Brew. Can optionally update the package database and check for existing installations. ```python Brew.install(["package1", "package2"], update=True, check=True) ``` -------------------------------- ### Cloning the example project Source: https://docs.conan.io/2/examples/conanfile/layout/multiple_subprojects.html Clone the example repository to follow along with the multi-subproject layout configuration. ```bash git clone https://github.com/conan-io/examples2.git cd examples2/examples/conanfile/layout/multiple_subprojects ``` -------------------------------- ### Cloning the Example Repository Source: https://docs.conan.io/2/examples/tools/cmake/cmake_toolchain/use_package_config_cmake.html Clone the examples2 repository to access the source code for this demonstration. ```bash git clone https://github.com/conan-io/examples2.git cd examples2/examples/tools/cmake/pkg_config_files ``` -------------------------------- ### Install Dependencies with Conan Source: https://docs.conan.io/2/tutorial/consuming_packages/use_tools_as_conan_packages.html Use the `conan install` command to install Zlib and the specified CMake version, generating necessary build files. ```bash conan install . --output-folder=build --build=missing ``` -------------------------------- ### Install with Direct Requirements Source: https://docs.conan.io/2/reference/commands/install.html Installs a specific package ('zlib/1.2.13') directly without using a conanfile. This is useful for quick installations or when a conanfile is not available. ```bash conan install --requires=zlib/1.2.13 ``` -------------------------------- ### Conanfile layout() Example Source: https://docs.conan.io/2/reference/conanfile/methods/layout.html Demonstrates setting source and build folders, defining include directories for source, library directories and names for build, and library names for the package. This example illustrates how to configure the layout for both local development and the Conan cache. ```python def layout(self): ... self.folders.source = "src" self.folders.build = "build" # In the local folder (when the package is in development, or "editable") the artifacts can be found: self.cpp.source.includedirs = ["my_includes"] self.cpp.build.libdirs = ["lib/x86_64"] self.cpp.build.libs = ["foo"] # In the Conan cache, we packaged everything at the default standard directories, the library to link # is "foo" self.cpp.package.libs = ["foo"] ``` -------------------------------- ### Create a Basic 'hello' Package Source: https://docs.conan.io/2/tutorial/versioning/revisions.html Initializes a new 'hello' package using the 'cmake_lib' template and creates it in the local cache. ```bash $ mkdir hello && cd hello $ conan remove hello* -c # clean possible existing ones $ conan new cmake_lib -d name=hello -d version=1.0 $ conan create . hello/1.0: Hello World Release! ... ``` -------------------------------- ### Clone Conan 2 Examples Repository Source: https://docs.conan.io/2/examples/config_files/settings/settings_user.html Clone the examples repository to access the project files for this demonstration. Navigate to the specific example directory. ```bash git clone https://github.com/conan-io/examples2.git cd examples2/examples/config_files/settings_user ``` -------------------------------- ### Install Pip Packages with PyEnv Source: https://docs.conan.io/2/reference/tools/system/pyenv.html Installs a list of pip packages into the PyEnv virtual environment. Additional arguments can be passed to the 'pip install' command. ```python pyenv.install(packages=["requests", "behave"]) ``` ```python pyenv.install(packages=["requests", "behave"], pip_args=["--no-cache-dir", "--index-url", "https://my.pypi.org/simple"]) ``` -------------------------------- ### Build and Run Compressor (Windows) Source: https://docs.conan.io/2/examples/tools/meson/build_simple_meson_project.html Steps to set up the Meson build environment and compile the application on Windows. ```bash $ cd build $ meson setup --native-file conan_meson_native.ini .. meson-src $ meson compile -C meson-src $ meson-src\compressor.exe ```