Skip to content

Commit 4ff3c43

Browse files
authored
conan config install-pkg with profile, settings (#3929)
1 parent 26e3173 commit 4ff3c43

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

reference/commands/config.rst

+48
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,54 @@ or it can download from a Conan remote directly specifying the repository URL:
161161
$ conan config install-pkg myconf/version --url=<url/conan/remote/repo>
162162
163163
164+
Conan configuration packages can also be parameterized depending on profiles, settings and options.
165+
For example, if some organization would like to manage their configuration slightly differently for Windows and other platforms they could do:
166+
167+
.. code-block:: python
168+
169+
import os
170+
from conan import ConanFile
171+
from conan.tools.files import copy
172+
173+
class Conf(ConanFile):
174+
name = "myconf"
175+
version = "0.1"
176+
settings = "os"
177+
package_type = "configuration"
178+
def package(self):
179+
f = "win" if self.settings.os == "Windows" else "nix"
180+
copy(self, "*.conf", src=os.path.join(self.build_folder, f), dst=self.package_folder)
181+
182+
183+
And if they had a layout with different ``global.conf`` for the different platforms, like:
184+
185+
.. code-block:: text
186+
187+
conanfile.py
188+
win/global.conf
189+
nix/global.conf
190+
191+
192+
They, they could create and upload their configuration package as:
193+
194+
.. code-block:: bash
195+
196+
$ conan export-pkg . -s os=Windows
197+
$ conan export-pkg . -s os=Linux
198+
$ conan upload "*" -r=remote -c
199+
200+
201+
Then, developers could do:
202+
203+
.. code-block:: bash
204+
205+
$ conan config install-pkg "myconf/[*]" -s os=Linux
206+
# or even implicitly, if they default build profile defines os=Linux
207+
$ conan config install-pkg "myconf/[*]"
208+
209+
210+
And they will get the correct configuration for their platform.
211+
164212

165213
conan config list
166214
-----------------

0 commit comments

Comments
 (0)