Skip to content

Commit

Permalink
conan config install-pkg with profile, settings (#3929)
Browse files Browse the repository at this point in the history
  • Loading branch information
memsharded authored Dec 3, 2024
1 parent 26e3173 commit 4ff3c43
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions reference/commands/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,54 @@ or it can download from a Conan remote directly specifying the repository URL:
$ conan config install-pkg myconf/version --url=<url/conan/remote/repo>
Conan configuration packages can also be parameterized depending on profiles, settings and options.
For example, if some organization would like to manage their configuration slightly differently for Windows and other platforms they could do:

.. code-block:: python
import os
from conan import ConanFile
from conan.tools.files import copy
class Conf(ConanFile):
name = "myconf"
version = "0.1"
settings = "os"
package_type = "configuration"
def package(self):
f = "win" if self.settings.os == "Windows" else "nix"
copy(self, "*.conf", src=os.path.join(self.build_folder, f), dst=self.package_folder)
And if they had a layout with different ``global.conf`` for the different platforms, like:

.. code-block:: text
conanfile.py
win/global.conf
nix/global.conf
They, they could create and upload their configuration package as:

.. code-block:: bash
$ conan export-pkg . -s os=Windows
$ conan export-pkg . -s os=Linux
$ conan upload "*" -r=remote -c
Then, developers could do:

.. code-block:: bash
$ conan config install-pkg "myconf/[*]" -s os=Linux
# or even implicitly, if they default build profile defines os=Linux
$ conan config install-pkg "myconf/[*]"
And they will get the correct configuration for their platform.


conan config list
-----------------
Expand Down

0 comments on commit 4ff3c43

Please sign in to comment.