aboutsummaryrefslogtreecommitdiffstats
path: root/src/app/qbs-setup-toolchains/msvcprobe.cpp
diff options
context:
space:
mode:
authorIvan Komissarov <abbapoh@gmail.com>2021-04-24 02:20:06 +0300
committerIvan Komissarov <abbapoh@gmail.com>2021-04-24 02:20:06 +0300
commita8bbaf016dc3092f6f6ad0c4a333e595da665983 (patch)
tree6b1b74bbca7850ed75da01cba5a72618f3cfa94b /src/app/qbs-setup-toolchains/msvcprobe.cpp
parent001bf31623c02ba8249dd066777d014d546eb7f9 (diff)
parent2f6eecdc96fcd693cecef8011d8f9500c7872fc7 (diff)
Merge branch '1.19' into master
Diffstat (limited to 'src/app/qbs-setup-toolchains/msvcprobe.cpp')
-rw-r--r--src/app/qbs-setup-toolchains/msvcprobe.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/app/qbs-setup-toolchains/msvcprobe.cpp b/src/app/qbs-setup-toolchains/msvcprobe.cpp
index bb54add9f..00aedaaab 100644
--- a/src/app/qbs-setup-toolchains/msvcprobe.cpp
+++ b/src/app/qbs-setup-toolchains/msvcprobe.cpp
@@ -58,6 +58,7 @@
#include <QtCore/qstringlist.h>
#include <algorithm>
+#include <set>
#include <vector>
using namespace qbs;
@@ -182,8 +183,20 @@ void msvcProbe(Settings *settings, std::vector<Profile> &profiles)
}
}
+ // we want the same MSVC version share the same suffix in profiles, thus use
+ // a set to know the number of versions processed so far
+ std::map<QString /*VS*/, std::set<QString /*vcInstallPath*/>> msvcCounters;
for (MSVC &msvc : msvcs) {
- const QString name = QLatin1String("MSVC") + msvc.version + QLatin1Char('-')
+ // each VS needs its own counter
+ auto &msvcVersions = msvcCounters[msvc.version];
+ // vcInstallPath is "Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.16.27023/bin"
+ // Since msvcs are sorted by version, when the new vcInstallPath is inserted, we start
+ // a new group of compilers of the same version incrementing the set size
+ msvcVersions.insert(msvc.vcInstallPath);
+ // index is the number of specific vcInstallPaths (e.g. compiler versions) seen so far
+ const qsizetype index = msvcVersions.size() - 1;
+ const QString suffix = index == 0 ? QString() : QStringLiteral("-%1").arg(index);
+ const QString name = QLatin1String("MSVC") + msvc.version + suffix + QLatin1Char('-')
+ msvc.architecture;
try {
msvc.init();