_SBCS doesn't work with OBJECT_LIBRARY projects
The code causing this seems to be in cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValues
, where the project type is explicitly checked:
if ((this->GeneratorTarget->GetType() <= cmStateEnums::OBJECT_LIBRARY &&
this->ClOptions[config]->UsingUnicode()) ||
this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT") ||
this->GlobalGenerator->TargetsWindowsPhone() ||
this->GlobalGenerator->TargetsWindowsStore() ||
this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_EXTENSIONS")) {
e1.Element("CharacterSet", "Unicode");
} else if (this->GeneratorTarget->GetType() <=
cmStateEnums::MODULE_LIBRARY &&
this->ClOptions[config]->UsingSBCS()) {
e1.Element("CharacterSet", "NotSet");
} else {
e1.Element("CharacterSet", "MultiByte");
}
I don't understand why those project type checks are there at all, but I guess the checks should probably be 2x <= cmStateEnums::OBJECT_LIBRARY
, not <= cmStateEnums::OBJECT_LIBRARY
for _UNICODE
and <= cmStateEnums::MODULE_LIBRARY
for _SBCS
.