summaryrefslogtreecommitdiffstats
path: root/Tests/SBCS
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 /Tests/SBCS
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 'Tests/SBCS')
-rw-r--r--Tests/SBCS/CMakeLists.txt6
-rw-r--r--Tests/SBCS/SBCS.cxx22
2 files changed, 28 insertions, 0 deletions
diff --git a/Tests/SBCS/CMakeLists.txt b/Tests/SBCS/CMakeLists.txt
new file mode 100644
index 0000000..b3c3c2c
--- /dev/null
+++ b/Tests/SBCS/CMakeLists.txt
@@ -0,0 +1,6 @@
+# a SBCS test case
+project (SBCS)
+
+add_definitions(-D_SBCS)
+
+add_executable (SBCS SBCS.cxx)
diff --git a/Tests/SBCS/SBCS.cxx b/Tests/SBCS/SBCS.cxx
new file mode 100644
index 0000000..6ce2c9f
--- /dev/null
+++ b/Tests/SBCS/SBCS.cxx
@@ -0,0 +1,22 @@
+// Test to verify that _SBCS being defined causes CharacterSet to be set to 0 (Single Byte Character Set)
+
+int main ()
+{
+#ifdef _UNICODE
+ bool UnicodeSet=true;
+#else
+ bool UnicodeSet=false;
+#endif
+
+#ifdef _MBCS
+ bool MBCSSet=true;
+#else
+ bool MBCSSet=false;
+#endif
+
+ // if neither _UNICODE nor _MBCS is set, CharacterSet must be set to SBCS.
+ bool SBCSSet=(!UnicodeSet && !MBCSSet);
+
+ // Reverse boolean to indicate error case correctly
+ return !SBCSSet;
+}