summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorAaron C. Meadows <corwin@shadowguarddev.com>2012-02-16 21:27:05 (GMT)
committerDavid Cole <david.cole@kitware.com>2012-02-17 16:30:23 (GMT)
commitba89e92ba622ed821a6adf31e8a6633d574ff656 (patch)
tree5821617cc9832315cd7c58e8082259e7a07cbd8a /Source
parente2042b68d36e0881bfc00f926a275dda3d6cbc9d (diff)
downloadCMake-ba89e92ba622ed821a6adf31e8a6633d574ff656.zip
CMake-ba89e92ba622ed821a6adf31e8a6633d574ff656.tar.gz
CMake-ba89e92ba622ed821a6adf31e8a6633d574ff656.tar.bz2
Visual Studio: Allow setting Single Byte Character Set (#12189)
For Visual Studio using the Preprocessor Define _SBCS. This behavior is similar to the way that _UNICODE and _MBCS work already. Added tests to confirm this behavior.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx4
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx5
-rw-r--r--Source/cmVisualStudioGeneratorOptions.cxx14
-rw-r--r--Source/cmVisualStudioGeneratorOptions.h1
4 files changed, 24 insertions, 0 deletions
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 11a0387..a23d6a1 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -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";
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 9418761..ab74265 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -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);
diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx
index 41230e7..9369af6 100644
--- a/Source/cmVisualStudioGeneratorOptions.cxx
+++ b/Source/cmVisualStudioGeneratorOptions.cxx
@@ -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)
diff --git a/Source/cmVisualStudioGeneratorOptions.h b/Source/cmVisualStudioGeneratorOptions.h
index 51a1362..a1a55da 100644
--- a/Source/cmVisualStudioGeneratorOptions.h
+++ b/Source/cmVisualStudioGeneratorOptions.h
@@ -48,6 +48,7 @@ public:
// Check for specific options.
bool UsingUnicode();
+ bool UsingSBCS();
bool IsDebug();
// Write options to output.