- Qbs Manual
- QbsModuleProviders
- conan
- Qbs 2.4.2

# conan

Module provider for the Conan package manager. More...

Since: | Qt 2.4

- List of all members, including inherited members

## Properties

- installDirectory : string

## Detailed Description

This module provider allows integration with the Conan package manager.

## Prerequisites

In order to use this provider, you will need `Conan` version 2.5.0 or higher. Earlier versions do not have the `QbsDeps` generator.

## Example

For details on how to setup a project to use with Conan, see the l{https://github.com/qbs/qbs/blob/master/examples/protobuf/addressbook_conan}{addressbook_conan} folder in examples. First, you will need a conanfile as shown below.

     [requires]
     protobuf/3.21.12
     [tool_requires]
     protobuf/3.21.12
     [generators]
     QbsDeps

We use the text version for simplicity, but you can use the Python conanfile as well.

Next, set the qbsModuleProviders property to `"conan"`:

     import qbs.Host

     CppApplication {
         consoleApplication: true
         condition: protobuf.cpp.present && qbs.targetPlatform === Host.platform()

         Depends { name: "cpp" }
         cpp.minimumMacosVersion: "11.0"

         Depends { name: "protobuf.cpp"; required: false }

         files: [
             "../shared/addressbook.proto",
             "main.cpp",
         ]
         qbsModuleProviders: "conan"
     }

Install Conan dependencies and run the QbsDeps generator from the `addressbook_conan` dir:

     $ conan install . -g=QbsDeps --output-folder=build --build missing

This will create the `./build/qbs-deps` directory contaning files for provider. Now you can pass the conan install directory to the provider:

     $ qbs moduleProviders.conan.installDirectory:build

You should see the following output if everything is correct:

     Build graph does not yet exist for configuration 'default'. Starting from scratch.
     Resolving project for configuration default
     Setting up Conan module 'protobuflib'
     Setting up Conan module 'zlib'
     ...
     Build done for configuration default.

## Property Documentation

installDirectory : string

The path to the conan install installDirectory.

Qbs searches for files created by the QbsDeps generator in that directory.

If not set, the provider will not be run.

Default: undefined