Skip to content

Commit

Permalink
Clarify docs for detect_msvc_update (#3931)
Browse files Browse the repository at this point in the history
* add docs

* fix block
  • Loading branch information
czoido authored Dec 3, 2024
1 parent bad8365 commit 5621967
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion reference/config_files/profiles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,23 @@ the associated runtime, you can use:
- ``default_msvc_runtime(compiler)``: returns tuple with runtime (e.g., "dynamic") and its version (e.g., "v143").
- ``default_cppstd(compiler, compiler_version)``: returns default C++ standard as a string (e.g., "gnu14").
- ``detect_default_compiler()``: returns tuple with compiler name (e.g., "gcc"), its version and the executable path.
- ``detect_msvc_update(version)``: returns MSVC update version as a string (e.g., "7").
- ``detect_msvc_update(version)``: returns the MSVC update version as a string (e.g.,
"12" for VS 17.12.1). Note that in Conan profiles, the ``compiler.update`` setting accepts
values from 0 to 10. To convert the result from ``detect_msvc_update`` into the
format required by profiles, you can do something like this:

Example:

.. code-block:: jinja
...
[settings]
compiler=msvc
compiler=194 # for msvc toolset starting in 14.40 (VS 17.10)
# If we are using VS 17.12 we convert 12 to 2 so it's 194 with update 2
compiler.update = "{{ (detect_api.detect_msvc_update(version) | int) % 10 }}"
...
- ``default_msvc_ide_version(version)``: returns MSVC IDE version as a string (e.g., "17").
- ``default_compiler_version(compiler, version)``: returns the default version that Conan uses in profiles,
typically dropping some of the minor or patch digits, that do not affect binary compatibility.
Expand Down

0 comments on commit 5621967

Please sign in to comment.