summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalVisualStudio10Generator.cxx
diff options
context:
space:
mode:
authorBasil Fierz <basil.fierz@hotmail.com>2018-06-20 20:34:54 (GMT)
committerBrad King <brad.king@kitware.com>2018-06-24 14:36:03 (GMT)
commit3c4698da3a3c8470c8b6b1d025b10af0d5371625 (patch)
tree7d5232118baba420164095bbe5939d3072d2c0fb /Source/cmGlobalVisualStudio10Generator.cxx
parentb759f7068f4e263917ab029f9e9a518dfd386ddb (diff)
downloadCMake-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/cmGlobalVisualStudio10Generator.cxx')
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx49
1 files changed, 31 insertions, 18 deletions
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 8c20313..a5709d5 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -263,25 +263,32 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset(
this->GeneratorToolsetVersion.clear();
}
- std::string const toolsetPath = this->GetAuxiliaryToolset();
- if (!toolsetPath.empty() && !cmSystemTools::FileExists(toolsetPath)) {
-
- std::ostringstream e;
- /* clang-format off */
- e <<
- "Generator\n"
- " " << this->GetName() << "\n"
- "given toolset and version specification\n"
- " " << this->GetPlatformToolsetString() << ",version=" <<
- this->GeneratorToolsetVersion << "\n"
- "does not seem to be installed at\n" <<
- " " << toolsetPath;
- ;
- /* clang-format on */
- mf->IssueMessage(cmake::FATAL_ERROR, e.str());
-
- // Clear the configured tool-set
+ bool const isDefaultToolset =
+ this->IsDefaultToolset(this->GeneratorToolsetVersion);
+ if (isDefaultToolset) {
+ // If the given version is the default toolset, remove the setting
this->GeneratorToolsetVersion.clear();
+ } else {
+ std::string const toolsetPath = this->GetAuxiliaryToolset();
+ if (!toolsetPath.empty() && !cmSystemTools::FileExists(toolsetPath)) {
+
+ std::ostringstream e;
+ /* clang-format off */
+ e <<
+ "Generator\n"
+ " " << this->GetName() << "\n"
+ "given toolset and version specification\n"
+ " " << this->GetPlatformToolsetString() << ",version=" <<
+ this->GeneratorToolsetVersion << "\n"
+ "does not seem to be installed at\n" <<
+ " " << toolsetPath;
+ ;
+ /* clang-format on */
+ mf->IssueMessage(cmake::FATAL_ERROR, e.str());
+
+ // Clear the configured tool-set
+ this->GeneratorToolsetVersion.clear();
+ }
}
}
@@ -615,6 +622,12 @@ cmGlobalVisualStudio10Generator::GetPlatformToolsetCudaString() const
return this->GeneratorToolsetCuda;
}
+bool cmGlobalVisualStudio10Generator::IsDefaultToolset(
+ const std::string&) const
+{
+ return true;
+}
+
std::string cmGlobalVisualStudio10Generator::GetAuxiliaryToolset() const
{
return {};