summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalVisualStudio10Generator.cxx
diff options
context:
space:
mode:
authorRichard Dzenis <rdzenis@whitecryption.com>2023-08-16 15:28:22 (GMT)
committerBrad King <brad.king@kitware.com>2023-08-16 19:02:54 (GMT)
commit899376d070f329a3dcf512b6c9ec805d694d462e (patch)
treeb50afc1ed498bede7b0ff2a451aaf30d9f5632d6 /Source/cmGlobalVisualStudio10Generator.cxx
parente70749e0d65f2bad841de92d3952b9297f326a34 (diff)
downloadCMake-899376d070f329a3dcf512b6c9ec805d694d462e.zip
CMake-899376d070f329a3dcf512b6c9ec805d694d462e.tar.gz
CMake-899376d070f329a3dcf512b6c9ec805d694d462e.tar.bz2
VS: Allow specifying VCTools version with the ClangCL toolset
Visual Studio supports specifying both: <PlatformToolset>ClangCL</PlatformToolset> <VCToolsVersion>14.32.31326</VCToolsVersion> Fixes: #25189
Diffstat (limited to 'Source/cmGlobalVisualStudio10Generator.cxx')
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx56
1 files changed, 31 insertions, 25 deletions
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 0bdc3f9..541db63 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -193,33 +193,39 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset(
if (!this->GeneratorToolsetVersion.empty() &&
this->GeneratorToolsetVersion != "Test Toolset Version"_s) {
- // If a specific minor version of the toolset was requested, verify that it
- // is compatible to the major version and that is exists on disk.
- // If not clear the value.
- std::string versionToolset = this->GeneratorToolsetVersion;
- cmsys::RegularExpression regex("[0-9][0-9]\\.[0-9][0-9]");
- if (regex.find(versionToolset)) {
- versionToolset = cmStrCat('v', versionToolset.erase(2, 1));
- } else {
- // Version not recognized. Clear it.
- versionToolset.clear();
- }
+ // If a specific minor version of the MSVC toolset is requested, verify
+ // that it is compatible with the PlatformToolset version. The ability to
+ // choose a minor version of MSVC has been available since v141.
+ std::string const& platformToolset = this->GetPlatformToolsetString();
+ cmsys::RegularExpression vcPlatformToolsetRegex("^v[0-9][0-9][0-9]$");
+ if (vcPlatformToolsetRegex.find(platformToolset) ||
+ platformToolset == "Test Toolset"_s) {
+ std::string versionToolset = this->GeneratorToolsetVersion;
+ cmsys::RegularExpression versionToolsetRegex("^[0-9][0-9]\\.[0-9][0-9]");
+ if (versionToolsetRegex.find(versionToolset)) {
+ versionToolset = cmStrCat('v', versionToolset.erase(2, 1));
+ } else {
+ // Version not recognized. Clear it.
+ versionToolset.clear();
+ }
- if (!cmHasPrefix(versionToolset, this->GetPlatformToolsetString())) {
- mf->IssueMessage(MessageType::FATAL_ERROR,
- cmStrCat("Generator\n"
- " ",
- this->GetName(),
- "\n"
- "given toolset and version specification\n"
- " ",
- this->GetPlatformToolsetString(),
- ",version=", this->GeneratorToolsetVersion,
- "\n"
- "contains an invalid version specification."));
+ if (!cmHasPrefix(versionToolset, platformToolset)) {
+ mf->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("Generator\n"
+ " ",
+ this->GetName(),
+ "\n"
+ "given toolset and version specification\n"
+ " ",
+ this->GetPlatformToolsetString(),
+ ",version=", this->GeneratorToolsetVersion,
+ "\n"
+ "contains an invalid version specification."));
- // Clear the configured tool-set
- this->GeneratorToolsetVersion.clear();
+ // Clear the configured tool-set
+ this->GeneratorToolsetVersion.clear();
+ }
}
std::string auxProps;