CMake Nightly Date Stamp
[kiteware-cmake.git] / Tests / RunCMake / showIncludes.c
blob3859049b1d7bb444ed455889136d589c88f7f518
1 #ifndef _CRT_SECURE_NO_WARNINGS
2 # define _CRT_SECURE_NO_WARNINGS
3 #endif
5 #if defined(_MSC_VER) && _MSC_VER >= 1928
6 # pragma warning(disable : 5105) /* macro expansion warning in windows.h */
7 #endif
8 #include <windows.h>
10 #include <stdio.h>
11 #include <stdlib.h>
13 int main(void)
15 /* 'cl /showIncludes' encodes output in the console output code page. */
16 unsigned int cp = GetConsoleOutputCP();
18 /* 'cl /showIncludes' prints output in the VS language. */
19 const char* vslang = getenv("VSLANG");
20 if (!vslang) {
21 fprintf(stderr, "VSLANG is not set.\n");
22 return 1;
25 printf("Console output code page: %u\n", cp);
26 printf("Console input code page: %u\n", GetConsoleCP());
27 printf("ANSI code page: %u\n", GetACP());
28 printf("OEM code page: %u\n", GetOEMCP());
29 printf("VSLANG: %s\n", vslang);
31 // clang-cl <= 17 (special case for test, not a real VS value).
32 if (strcmp(vslang, "clang-cl-17") == 0) {
33 if (cp == 437 || cp == 65001) {
34 printf("Note: including file: ./foo.h\n");
35 return 0;
39 // clang-cl >= 18 (special case for test, not a real VS value).
40 if (strcmp(vslang, "clang-cl-18") == 0) {
41 if (cp == 437 || cp == 65001) {
42 printf("Note: including file: .\\\\foo.h\n");
43 return 0;
47 // msvc-wine (special case for test, not a real VS value).
48 if (strcmp(vslang, "msvc-wine") == 0) {
49 if (cp == 437 || cp == 65001) {
50 printf("Note: including file: /c/foo.h\n");
51 return 0;
55 // German.
56 if (strcmp(vslang, "1031") == 0) {
57 if (cp == 437 || cp == 65001) {
58 printf("Hinweis: Einlesen der Datei: C:\\foo.h\n");
59 return 0;
63 // English.
64 if (strcmp(vslang, "1033") == 0) {
65 if (cp == 437 || cp == 65001) {
66 printf("Note: including file: C:\\foo.h\n");
67 return 0;
71 // French.
72 if (strcmp(vslang, "1036") == 0) {
73 if (cp == 437 || cp == 863) {
74 printf("Remarque\xff: inclusion du fichier\xff: C:\\foo.h\n");
75 return 0;
77 if (cp == 65001) {
78 printf("Remarque\xc2\xa0: inclusion du fichier\xc2\xa0: C:\\foo.h\n");
79 return 0;
83 // Italian.
84 if (strcmp(vslang, "1040") == 0) {
85 if (cp == 437 || cp == 65001) {
86 printf("Nota: file incluso C:\\foo.h\n");
87 return 0;
91 // Japanese.
92 if (strcmp(vslang, "1041") == 0) {
93 if (cp == 932) {
94 printf("\x83\x81\x83\x82: "
95 "\x83\x43\x83\x93\x83\x4e\x83\x8b\x81\x5b\x83\x68 "
96 "\x83\x74\x83\x40\x83\x43\x83\x8b: C:\\foo.h\n");
97 return 0;
99 if (cp == 65001) {
100 printf("\xe3\x83\xa1\xe3\x83\xa2: \xe3\x82\xa4\xe3\x83\xb3"
101 "\xe3\x82\xaf\xe3\x83\xab\xe3\x83\xbc\xe3\x83\x89 "
102 "\xe3\x83\x95\xe3\x82\xa1\xe3\x82\xa4\xe3\x83\xab: C:\\foo.h\n");
103 return 0;
107 // Chinese.
108 if (strcmp(vslang, "2052") == 0) {
109 if (cp == 54936 || cp == 936) {
110 printf("\xd7\xa2\xd2\xe2: "
111 "\xb0\xfc\xba\xac\xce\xc4\xbc\xfe: C:\\foo.h\n");
112 return 0;
115 if (cp == 65001) {
116 printf("\xe6\xb3\xa8\xe6\x84\x8f: "
117 "\xe5\x8c\x85\xe5\x90\xab\xe6\x96\x87\xe4\xbb\xb6: C:\\foo.h\n");
118 return 0;
122 fprintf(stderr, "No example showIncludes for this code page and VSLANG.\n");
123 return 1;