Skip to content

Commit

Permalink
HOTFIX: Clarify MSBuild helper attributes (#2698)
Browse files Browse the repository at this point in the history
  • Loading branch information
lasote committed Aug 16, 2022
1 parent 2a1f38c commit cb1c19c
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions reference/tools/microsoft/msbuild.rst
Expand Up @@ -26,19 +26,44 @@ The ``MSBuild.build()`` method internally implements a call to ``msbuild`` like:

.. code:: bash
$ <vcvars-cmd> && msbuild "MyProject.sln" /p:Configuration=<conf> /p:Platform=<platform>
$ <vcvars-cmd> && msbuild "MyProject.sln" /p:Configuration=<configuration> /p:Platform=<platform>
Where:

- ``<vcvars-cmd>`` calls the Visual Studio prompt that matches the current recipe ``settings``.
- ``<conf>`` is the configuration, typically ``Release``, or ``Debug``, which is obtained from ``settings.build_type``,
but this is configurable.
- ``configuration``, typically Release, Debug, which will be obtained from ``settings.build_type``
but this can be customized with the ``build_type`` attribute.
- ``<platform>`` is the architecture, a mapping from the ``settings.arch`` to the common 'x86', 'x64', 'ARM', 'ARM64'.
This can be customized with the ``platform`` attribute.


Customization
---------------

attributes
++++++++++

You can customize the following attributes in case you need to change them:

- **build_type** (default ``settings.build_type``): Value for the ``/p:Configuration``.
- **platform** (default based on ``settings.arch`` to select one of these values: (``'x86', 'x64', 'ARM', 'ARM64'``):
Value for the ``/p:Platform``.

Example:

.. code:: python
from conan import ConanFile
from conan.tools.microsoft import MSBuild
class App(ConanFile):
settings = "os", "arch", "compiler", "build_type"
def build(self):
msbuild = MSBuild(self)
msbuild.build_type = "MyRelease"
msbuild.platform = "MyPlatform"
msbuild.build("MyProject.sln")
conf
++++

Expand Down

0 comments on commit cb1c19c

Please sign in to comment.