diff options
author | Basil Fierz <basil.fierz@hotmail.com> | 2018-06-20 20:34:54 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-06-24 14:36:03 (GMT) |
commit | 3c4698da3a3c8470c8b6b1d025b10af0d5371625 (patch) | |
tree | 7d5232118baba420164095bbe5939d3072d2c0fb /Source/cmGlobalVisualStudio15Generator.cxx | |
parent | b759f7068f4e263917ab029f9e9a518dfd386ddb (diff) | |
download | CMake-3c4698da3a3c8470c8b6b1d025b10af0d5371625.zip CMake-3c4698da3a3c8470c8b6b1d025b10af0d5371625.tar.gz CMake-3c4698da3a3c8470c8b6b1d025b10af0d5371625.tar.bz2 |
VS: Allow toolset version selection to specify default toolset
Teach the feature added by commit v3.12.0-rc1~38^2 (VS: Add option to
select the version of the toolset used by VS 2017, 2018-05-19) to accept
the default toolset version in addition to older versions. If the
default toolset version is supplied, simply clear it so the default will
be used.
Fixes: #18107
Diffstat (limited to 'Source/cmGlobalVisualStudio15Generator.cxx')
-rw-r--r-- | Source/cmGlobalVisualStudio15Generator.cxx | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Source/cmGlobalVisualStudio15Generator.cxx b/Source/cmGlobalVisualStudio15Generator.cxx index 6af5793..9983a43 100644 --- a/Source/cmGlobalVisualStudio15Generator.cxx +++ b/Source/cmGlobalVisualStudio15Generator.cxx @@ -158,6 +158,27 @@ bool cmGlobalVisualStudio15Generator::GetVSInstance(std::string& dir) const return vsSetupAPIHelper.GetVSInstanceInfo(dir); } +bool cmGlobalVisualStudio15Generator::IsDefaultToolset( + const std::string& version) const +{ + if (version.empty()) { + return true; + } + + std::string vcToolsetVersion; + if (this->vsSetupAPIHelper.GetVCToolsetVersion(vcToolsetVersion)) { + + cmsys::RegularExpression regex("[0-9][0-9]\\.[0-9]+"); + if (regex.find(version) && regex.find(vcToolsetVersion)) { + const auto majorMinorEnd = vcToolsetVersion.find('.', 3); + const auto majorMinor = vcToolsetVersion.substr(0, majorMinorEnd); + return version == majorMinor; + } + } + + return false; +} + std::string cmGlobalVisualStudio15Generator::GetAuxiliaryToolset() const { const char* version = this->GetPlatformToolsetVersion(); |