From 4419bf11820d9aa1faba95444519c05448b73dd8 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 8 Jan 2026 11:19:45 -0500 Subject: VS: Restore unicode character set for custom targrets on WindowsStore Restore conditions broken by commit 19a61e56cf (VS: Refactor MSVC character set selection, 2025-10-10, v4.2.0-rc1~12^2~1). We had misread the purpose/scope of the `<= cmStateEnums::OBJECT_LIBRARY` condition. In the original code it was only about safely indexing `ClOptions`, not about the kinds of targets that can use a unicode character set. Fixes: #27490 --- Source/cmVisualStudio10TargetGenerator.cxx | 31 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 9e706a5..e1b8475 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -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"); -- cgit v0.12