Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs for replace_requires, replace_tool_requires, platform_requires and platform_tool_requires profile sections #3495

Merged
merged 9 commits into from
Dec 19, 2023
48 changes: 42 additions & 6 deletions reference/config_files/profiles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,27 @@ They have this structure:
[options]
MyLib:shared=True

[buildenv]
VAR1=value

[tool_requires]
tool1/0.1@user/channel
*: tool4/0.1@user/channel

[system_tools]
danimtb marked this conversation as resolved.
Show resolved Hide resolved
cmake/3.24.2

[buildenv]
VAR1=value

[runenv]
EnvironmentVar1=My Value

[conf]
tools.build:jobs=2

[replace_requires]
zlib/1.2.123: zlib/*

[replace_tool_requires]
7zip/*: 7zip/system

Profiles can be created with the ``detect`` option in :ref:`conan profile <reference_commands_profile>` command,
and edited later. If you don't specify a *name*, the command will create the ``default`` profile:
Expand Down Expand Up @@ -182,7 +193,7 @@ List of settings available from :ref:`reference_config_files_settings_yml`:


[options]
++++++++++
+++++++++

List of options available from your recipe and its dependencies:

Expand Down Expand Up @@ -380,12 +391,11 @@ Then, the result of applying this profile is:
.. _reference_config_files_profiles_runenv:

[runenv]
++++++++++
++++++++

List of environment variables that will be injected to the environment every time the ConanFile
``run(cmd, env="conanrun")`` method is invoked (runtime context is automatically run by :ref:`conan_tools_env_virtualrunenv`).


All the operators/patterns explained for :ref:`reference_config_files_profiles_buildenv` applies to this one in the same way:

.. code-block:: text
Expand Down Expand Up @@ -470,6 +480,32 @@ Running, for instance, :command:`conan install . -pr myprofile`, the configurati
user.myconf.build:ldflags=['--prefix prefix-value', '--flag1 value1', '--flag2 value2']
...

.. _reference_config_files_profiles_replace_requires:

[replace_requires]
++++++++++++++++++

This section allows the user to redefine requires of recipes. This can be useful when a package can be changed by a similar one like `zlib` and `zlibng`.
danimtb marked this conversation as resolved.
Show resolved Hide resolved
It is also usefult to solve conflicts, or to replace some dependencies by system alternatives wrapped in another Conan package recipe.

.. code-block:: text
:caption: *myprofile*

[replace_requires]
zlib/*: zlibng/*
danimtb marked this conversation as resolved.
Show resolved Hide resolved

.. _reference_config_files_profiles_replace_tool_requires:

[replace_tool_requires]
+++++++++++++++++++++++

Same usage as the `replace_requires` section but in this case for `tool_requires`.
danimtb marked this conversation as resolved.
Show resolved Hide resolved

.. code-block:: text
:caption: *myprofile*

[replace_tool_requires]
cmake/*: cmake/system

.. _reference_config_files_profiles_rendering:

Expand Down