mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-01 04:08:46 -06:00
Merge topic 'fix-12189-support-SBCS-in-VS'
b28e7faVS6: Avoid SBCS test on VS6 (#12189)df19b9cVS6: Avoid _MBCS define when _SBCS is defined (#12189)ba89e92Visual Studio: Allow setting Single Byte Character Set (#12189)
This commit is contained in:
@@ -1620,11 +1620,13 @@ void cmLocalVisualStudio6Generator
|
||||
flagsDebugRel = this->Makefile->GetSafeDefinition(flagVar.c_str());
|
||||
flagsDebugRel += " -DCMAKE_INTDIR=\\\"RelWithDebInfo\\\" ";
|
||||
}
|
||||
|
||||
// if unicode is not found, then add -D_MBCS
|
||||
|
||||
// if _UNICODE and _SBCS are not found, then add -D_MBCS
|
||||
std::string defs = this->Makefile->GetDefineFlags();
|
||||
if(flags.find("D_UNICODE") == flags.npos &&
|
||||
defs.find("D_UNICODE") == flags.npos)
|
||||
defs.find("D_UNICODE") == flags.npos &&
|
||||
flags.find("D_SBCS") == flags.npos &&
|
||||
defs.find("D_SBCS") == flags.npos)
|
||||
{
|
||||
flags += " /D \"_MBCS\"";
|
||||
}
|
||||
|
||||
@@ -774,6 +774,10 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
|
||||
{
|
||||
fout << "\t\t\tCharacterSet=\"1\">\n";
|
||||
}
|
||||
else if(targetOptions.UsingSBCS())
|
||||
{
|
||||
fout << "\t\t\tCharacterSet=\"0\">\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
fout << "\t\t\tCharacterSet=\"2\">\n";
|
||||
|
||||
@@ -394,6 +394,11 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
|
||||
{
|
||||
this->WriteString("<CharacterSet>Unicode</CharacterSet>\n", 2);
|
||||
}
|
||||
else if (this->Target->GetType() <= cmTarget::MODULE_LIBRARY &&
|
||||
this->ClOptions[*i]->UsingSBCS())
|
||||
{
|
||||
this->WriteString("<CharacterSet>NotSet</CharacterSet>\n", 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->WriteString("<CharacterSet>MultiByte</CharacterSet>\n", 2);
|
||||
|
||||
@@ -117,6 +117,20 @@ bool cmVisualStudioGeneratorOptions::UsingUnicode()
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
bool cmVisualStudioGeneratorOptions::UsingSBCS()
|
||||
{
|
||||
// Look for the a _SBCS definition.
|
||||
for(std::vector<std::string>::const_iterator di = this->Defines.begin();
|
||||
di != this->Defines.end(); ++di)
|
||||
{
|
||||
if(*di == "_SBCS")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmVisualStudioGeneratorOptions::Parse(const char* flags)
|
||||
|
||||
@@ -48,6 +48,7 @@ public:
|
||||
|
||||
// Check for specific options.
|
||||
bool UsingUnicode();
|
||||
bool UsingSBCS();
|
||||
|
||||
bool IsDebug();
|
||||
// Write options to output.
|
||||
|
||||
Reference in New Issue
Block a user