Skip to content

Commit 5621967

Browse files
authored
Clarify docs for detect_msvc_update (#3931)
* add docs * fix block
1 parent bad8365 commit 5621967

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

reference/config_files/profiles.rst

+17-1
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,23 @@ the associated runtime, you can use:
681681
- ``default_msvc_runtime(compiler)``: returns tuple with runtime (e.g., "dynamic") and its version (e.g., "v143").
682682
- ``default_cppstd(compiler, compiler_version)``: returns default C++ standard as a string (e.g., "gnu14").
683683
- ``detect_default_compiler()``: returns tuple with compiler name (e.g., "gcc"), its version and the executable path.
684-
- ``detect_msvc_update(version)``: returns MSVC update version as a string (e.g., "7").
684+
- ``detect_msvc_update(version)``: returns the MSVC update version as a string (e.g.,
685+
"12" for VS 17.12.1). Note that in Conan profiles, the ``compiler.update`` setting accepts
686+
values from 0 to 10. To convert the result from ``detect_msvc_update`` into the
687+
format required by profiles, you can do something like this:
688+
689+
Example:
690+
691+
.. code-block:: jinja
692+
693+
...
694+
[settings]
695+
compiler=msvc
696+
compiler=194 # for msvc toolset starting in 14.40 (VS 17.10)
697+
# If we are using VS 17.12 we convert 12 to 2 so it's 194 with update 2
698+
compiler.update = "{{ (detect_api.detect_msvc_update(version) | int) % 10 }}"
699+
...
700+
685701
- ``default_msvc_ide_version(version)``: returns MSVC IDE version as a string (e.g., "17").
686702
- ``default_compiler_version(compiler, version)``: returns the default version that Conan uses in profiles,
687703
typically dropping some of the minor or patch digits, that do not affect binary compatibility.

0 commit comments

Comments
 (0)