Skip to content

Commit d728eba

Browse files
authored
Add profile context docs (#4136)
* Add profile context docs * Possiuble values * Fix codeblock
1 parent 01dcdd6 commit d728eba

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

reference/config_files/profiles.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,24 @@ Some of the capabilities of the profile templates are:
626626
[settings]
627627
compiler.version={{ version }}
628628
629+
- Branching based on the context that the profile is being rendered for.
630+
The ``context`` variable is injected and can take the values ``host``, ``build`` or be ``None``.
631+
For example, you can define different settings for the host and build contexts
632+
without having to create two different profiles:
633+
634+
.. code-block:: jinja
635+
:caption: *profile_vars*
636+
637+
[settings]
638+
os=Linux
639+
compiler=gcc
640+
compiler.version=12
641+
{% if context == "host" %}
642+
compiler.cppstd=gnu17
643+
{% else %}
644+
compiler.cppstd=gnu20
645+
{% endif %}
646+
629647
- Including or importing other files from ``profiles`` folder:
630648

631649
.. code-block:: jinja

0 commit comments

Comments
 (0)