Merge topic 'vs-charset' into release-4.2

4419bf1182 VS: Restore unicode character set for custom targrets on WindowsStore

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11578
This commit is contained in:
Brad King
2026-01-09 14:47:55 +00:00
committed by Kitware Robot

View File

@@ -439,18 +439,20 @@ void cmVisualStudio10TargetGenerator::Generate()
if (!this->ComputeLibOptions()) {
return;
}
for (std::string const& config : this->Configurations) {
// Default character set if not populated above.
this->CharSet.emplace(
config,
(this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT") ||
this->GlobalGenerator->TargetsWindowsPhone() ||
this->GlobalGenerator->TargetsWindowsStore() ||
this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
? MsvcCharSet::Unicode
: MsvcCharSet::MultiByte);
}
}
for (std::string const& config : this->Configurations) {
// Default character set if not populated above.
this->CharSet.emplace(
config,
(this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT") ||
this->GlobalGenerator->TargetsWindowsPhone() ||
this->GlobalGenerator->TargetsWindowsStore() ||
this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
? MsvcCharSet::Unicode
: MsvcCharSet::MultiByte);
}
std::string path =
cmStrCat(this->LocalGenerator->GetCurrentBinaryDirectory(), '/',
this->Name, ProjectFileExtension);
@@ -1552,12 +1554,9 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValues(
e1.Element("UseOfMfc", useOfMfcValue);
}
if ((this->GeneratorTarget->GetType() <= cmStateEnums::OBJECT_LIBRARY &&
this->CharSet[config] == MsvcCharSet::Unicode)) {
if (this->CharSet[config] == MsvcCharSet::Unicode) {
e1.Element("CharacterSet", "Unicode");
} else if (this->GeneratorTarget->GetType() <=
cmStateEnums::OBJECT_LIBRARY &&
this->CharSet[config] == MsvcCharSet::SingleByte) {
} else if (this->CharSet[config] == MsvcCharSet::SingleByte) {
e1.Element("CharacterSet", "NotSet");
} else {
e1.Element("CharacterSet", "MultiByte");