Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
franramirez688 committed Feb 9, 2023
1 parent e16935d commit 384323e
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 63 deletions.
73 changes: 12 additions & 61 deletions reference/config_files/global_conf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -106,25 +106,26 @@ To list all the possible configurations available, run :command:`conan config li
tools.system.package_manager:tool: Default package manager tool: 'apt-get', 'yum', 'dnf', 'brew', 'pacman', 'choco', 'zypper', 'pkg' or 'pkgutil'
User/Tools configurations
-------------------------

Tools and user configurations can be defined in both the *global.conf* file and
:ref:`Conan profiles <reference_config_files_profiles_conf>`. They look like:

Tools configurations
--------------------

Tools and user configurations allow them to be defined both in the *global.conf* file and in profile files. Profile values will
have priority over globally defined ones in *global.conf*, and can be defined as:

.. code-block:: text
:caption: *myprofile*
[settings]
...
:caption: *global.conf*
[conf]
tools.microsoft.msbuild:verbosity=Diagnostic
tools.microsoft.msbuild:max_cpu_count=2
tools.microsoft.msbuild:vs_version = 16
tools.build:jobs=10
# User conf variable
user.confvar:something=False
.. important::

Profiles values will have priority over globally defined ones in global.conf.


Configuration file template
Expand Down Expand Up @@ -168,7 +169,6 @@ All the values will be interpreted by Conan as the result of the python built-in
Configuration data operators
----------------------------


It's also possible to use some extra operators when you're composing tool configurations in your *global.conf* or
any of your profiles:

Expand All @@ -177,12 +177,8 @@ any of your profiles:
* ``=!`` == ``unset``: gets rid of any configuration value.

.. code-block:: text
:caption: *myprofile*
[settings]
...
:caption: *global.conf*
[conf]
# Define the value => ["-f1"]
user.myconf.build:flags=["-f1"]
Expand All @@ -196,51 +192,6 @@ any of your profiles:
user.myconf.build:flags=!
Configuration in your profiles
--------------------------------

Let's see a little bit more complex example trying different configurations coming from the *global.conf* and a simple profile:

.. code-block:: text
:caption: *global.conf*
# Defining several lists
user.myconf.build:ldflags=["--flag1 value1"]
user.myconf.build:cflags=["--flag1 value1"]
.. code-block:: text
:caption: *myprofile*
[settings]
...
[conf]
# Appending values into the existing list
user.myconf.build:ldflags+=["--flag2 value2"]
# Unsetting the existing value (it'd be like we define it as an empty value)
user.myconf.build:cflags=!
# Prepending values into the existing list
user.myconf.build:ldflags=+["--prefix prefix-value"]
Running, for instance, :command:`conan install . -pr myprofile`, the configuration output will be something like:

.. code-block:: bash
...
Configuration:
[settings]
[options]
[tool_requires]
[conf]
user.myconf.build:cflags=!
user.myconf.build:ldflags=['--prefix prefix-value', '--flag1 value1', '--flag2 value2']
...
Configuration patterns
----------------------

Expand Down
55 changes: 53 additions & 2 deletions reference/config_files/profiles_default.rst
Original file line number Diff line number Diff line change
Expand Up @@ -310,12 +310,16 @@ All the operators/patterns explained for :ref:`reference_config_files_profiles_b
MyPath1=+(path)/other path/path12
MyPath1=!
.. _reference_config_files_profiles_conf:

[conf]
++++++

List of user/tools configurations. They can also be used in :ref:`reference_config_files_global_conf` too.
**Profile values will have priority over globally defined ones in global.conf**, and can be defined as:
.. note::

It's recommended to read before the :ref:`reference_config_files_global_conf` section.

List of user/tools configurations:

.. code-block:: text
:caption: *myprofile*
Expand All @@ -325,6 +329,53 @@ List of user/tools configurations. They can also be used in :ref:`reference_conf
tools.microsoft.msbuild:max_cpu_count=2
tools.microsoft.msbuild:vs_version = 16
tools.build:jobs=10
# User conf variable
user.confvar:something=False
They can also be used in :ref:`reference_config_files_global_conf`,
but **profiles values will have priority over globally defined ones in global.conf**, so let's see a little bit
more complex example trying different configurations coming from the *global.conf* and another profile *myprofile*:


.. code-block:: text
:caption: *global.conf*
# Defining several lists
user.myconf.build:ldflags=["--flag1 value1"]
user.myconf.build:cflags=["--flag1 value1"]
.. code-block:: text
:caption: *myprofile*
[settings]
...
[conf]
# Appending values into the existing list
user.myconf.build:ldflags+=["--flag2 value2"]
# Unsetting the existing value (it'd be like we define it as an empty value)
user.myconf.build:cflags=!
# Prepending values into the existing list
user.myconf.build:ldflags=+["--prefix prefix-value"]
Running, for instance, :command:`conan install . -pr myprofile`, the configuration output will be something like:

.. code-block:: bash
...
Configuration:
[settings]
[options]
[tool_requires]
[conf]
user.myconf.build:cflags=!
user.myconf.build:ldflags=['--prefix prefix-value', '--flag1 value1', '--flag2 value2']
...
Profile patterns
Expand Down

0 comments on commit 384323e

Please sign in to comment.