mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-22 16:07:49 +08:00
VS: Allow specifying VCTools version with the ClangCL toolset
Visual Studio supports specifying both: <PlatformToolset>ClangCL</PlatformToolset> <VCToolsVersion>14.32.31326</VCToolsVersion> Fixes: #25189
This commit is contained in:

committed by
Brad King

parent
e70749e0d6
commit
899376d070
@@ -193,20 +193,25 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset(
|
|||||||
|
|
||||||
if (!this->GeneratorToolsetVersion.empty() &&
|
if (!this->GeneratorToolsetVersion.empty() &&
|
||||||
this->GeneratorToolsetVersion != "Test Toolset Version"_s) {
|
this->GeneratorToolsetVersion != "Test Toolset Version"_s) {
|
||||||
// If a specific minor version of the toolset was requested, verify that it
|
// If a specific minor version of the MSVC toolset is requested, verify
|
||||||
// is compatible to the major version and that is exists on disk.
|
// that it is compatible with the PlatformToolset version. The ability to
|
||||||
// If not clear the value.
|
// 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;
|
std::string versionToolset = this->GeneratorToolsetVersion;
|
||||||
cmsys::RegularExpression regex("[0-9][0-9]\\.[0-9][0-9]");
|
cmsys::RegularExpression versionToolsetRegex("^[0-9][0-9]\\.[0-9][0-9]");
|
||||||
if (regex.find(versionToolset)) {
|
if (versionToolsetRegex.find(versionToolset)) {
|
||||||
versionToolset = cmStrCat('v', versionToolset.erase(2, 1));
|
versionToolset = cmStrCat('v', versionToolset.erase(2, 1));
|
||||||
} else {
|
} else {
|
||||||
// Version not recognized. Clear it.
|
// Version not recognized. Clear it.
|
||||||
versionToolset.clear();
|
versionToolset.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cmHasPrefix(versionToolset, this->GetPlatformToolsetString())) {
|
if (!cmHasPrefix(versionToolset, platformToolset)) {
|
||||||
mf->IssueMessage(MessageType::FATAL_ERROR,
|
mf->IssueMessage(
|
||||||
|
MessageType::FATAL_ERROR,
|
||||||
cmStrCat("Generator\n"
|
cmStrCat("Generator\n"
|
||||||
" ",
|
" ",
|
||||||
this->GetName(),
|
this->GetName(),
|
||||||
@@ -221,6 +226,7 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset(
|
|||||||
// Clear the configured tool-set
|
// Clear the configured tool-set
|
||||||
this->GeneratorToolsetVersion.clear();
|
this->GeneratorToolsetVersion.clear();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string auxProps;
|
std::string auxProps;
|
||||||
switch (this->FindAuxToolset(this->GeneratorToolsetVersion, auxProps)) {
|
switch (this->FindAuxToolset(this->GeneratorToolsetVersion, auxProps)) {
|
||||||
|
Reference in New Issue
Block a user