Skip to content

Commit 71c0a05

Browse files
authored
fix MSBuildToolchain docstring (#4330)
1 parent 917585f commit 71c0a05

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

reference/tools/microsoft/msbuildtoolchain.rst

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ conf
7474
``MSBuildToolchain`` is affected by these ``[conf]`` variables:
7575

7676
- ``tools.microsoft.msbuildtoolchain:compile_options`` dict-like object of extra compile options to be added to ``<ClCompile>`` section.
77-
The dict will be translated as follows: ``<[KEY]>[VALUE]</[KEY]>``.
77+
The dict will be translated as follows: ``<[KEY]>[VALUE]</[KEY]>`` and inserted inside the ``<ClCompile>`` element. If the ``compile_options``
78+
attribute is defined, it will be updated with the values from this dict.
7879
- ``tools.microsoft:winsdk_version`` value will define the ``<WindowsTargetPlatformVersion>`` element in the toolchain file.
7980
- ``tools.build:cxxflags`` list of extra C++ flags that will be appended to ``<AdditionalOptions>`` section from ``<ClCompile>`` and ``<ResourceCompile>`` one.
8081
- ``tools.build:cflags`` list of extra of pure C flags that will be appended to ``<AdditionalOptions>`` section from ``<ClCompile>`` and ``<ResourceCompile>`` one.
@@ -128,3 +129,28 @@ in its contents:
128129
...
129130
</PropertyGroup>
130131
</Project>
132+
133+
134+
* **compile_options**: Additional compile options added to the generated ``.props`` files. You can
135+
define the properties in a key-value syntax like:
136+
137+
.. code:: python
138+
139+
def generate(self):
140+
msbuild = MSBuildToolchain(self)
141+
msbuild.compile_options = {'ExceptionHandling': 'Async'}
142+
msbuild.generate()
143+
144+
Then, the generated *conantoolchain_<config>.props* file will contain the defined compile option
145+
in its contents:
146+
147+
.. code-block:: xml
148+
149+
<ClCompile>
150+
...
151+
<LanguageStandard>...</LanguageStandard>
152+
<ExceptionHandling>Async</ExceptionHandling>
153+
</ClCompile>
154+
155+
156+
Note this attribute will be updated with the ``conf`` from ``tools.microsoft.msbuildtoolchain:compile_options``.

0 commit comments

Comments
 (0)