diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2016-11-10 09:40:09 +0100 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2016-11-14 15:50:49 +0000 |
commit | 2713f080bb34a2513dc5585a209bdc95ab815e45 (patch) | |
tree | 8a021203d9d0a876ec58487ffc3ddbe7558930e2 /qmake/generators/win32/msvc_objectmodel.cpp | |
parent | a3c9550d7cef969298c43276cbfe92abb8578ce5 (diff) |
Remove wondrous VS version detection logic
Replace which_dotnet_version with a simple function that converts the
value of MSVC_VER to its corresponding enum value in the VS project
generator.
This reduces the maintenance burden when adding support for a new VS
version, because we do not need to update the registry keys in
which_dotnet_version anymore.
The which_dotnet_version function implemented the following logic:
- find all installed VS versions via registry
- select the "best matching one"
- if there is no best match, select the VS that's in PATH
- create a project for that VS installation
The usefulness of this whole stunt is questionable as the VS version of
Qt's mkspec must match the version of a project using that Qt anyway.
Change-Id: I9fb9a099ee5ddb5fc4c450be4f68f41f2b406b9a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'qmake/generators/win32/msvc_objectmodel.cpp')
-rw-r--r-- | qmake/generators/win32/msvc_objectmodel.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index aa733bfc36..219b889706 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -34,6 +34,36 @@ QT_BEGIN_NAMESPACE +static DotNET vsVersionFromString(const char *versionString) +{ + struct VSVersionMapping + { + const char *str; + DotNET version; + }; + static VSVersionMapping mapping[] = { + "7.0", NET2002, + "7.1", NET2003, + "8.0", NET2005, + "9.0", NET2008, + "10.0", NET2010, + "11.0", NET2012, + "12.0", NET2013, + "14.0", NET2015 + }; + DotNET result = NETUnknown; + for (const auto entry : mapping) { + if (strcmp(entry.str, versionString) == 0) + return entry.version; + } + return result; +} + +DotNET vsVersionFromString(const ProString &versionString) +{ + return vsVersionFromString(versionString.toLatin1().constData()); +} + // XML Tags --------------------------------------------------------- const char _Configuration[] = "Configuration"; const char _Configurations[] = "Configurations"; |