Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Tests / Preprocess / preprocess.cxx
blob27b6ac89a656c77e464a1af9836069629149192e
1 #include <preprocess.h>
3 #include FILE_PATH
4 #include TARGET_PATH
6 #include <string.h>
7 #include <stdio.h>
9 extern "C" int check_defines_C(void);
11 int check_defines_CXX()
13 int result = 1;
14 if(strcmp(FILE_STRING, STRING_VALUE) != 0)
16 fprintf(stderr,
17 "FILE_STRING has wrong value in CXX [%s]\n", FILE_STRING);
18 result = 0;
20 if(strcmp(TARGET_STRING, STRING_VALUE) != 0)
22 fprintf(stderr,
23 "TARGET_STRING has wrong value in CXX [%s]\n", TARGET_STRING);
24 result = 0;
27 int x = 2;
28 int y = 3;
29 if((FILE_EXPR) != (EXPR))
31 fprintf(stderr, "FILE_EXPR did not work in CXX [%s]\n",
32 TO_STRING(FILE_EXPR));
33 result = 0;
35 if((TARGET_EXPR) != (EXPR))
37 fprintf(stderr, "TARGET_EXPR did not work in CXX [%s]\n",
38 TO_STRING(FILE_EXPR));
39 result = 0;
42 #ifdef NDEBUG
43 # ifdef FILE_DEF_DEBUG
45 fprintf(stderr, "FILE_DEF_DEBUG should not be defined in CXX\n");
46 result = 0;
48 # endif
49 # ifdef TARGET_DEF_DEBUG
51 fprintf(stderr, "TARGET_DEF_DEBUG should not be defined in CXX\n");
52 result = 0;
54 # endif
55 # ifdef DIRECTORY_DEF_DEBUG
57 fprintf(stderr, "DIRECTORY_DEF_DEBUG should not be defined in CXX\n");
58 result = 0;
60 # endif
61 # ifndef FILE_DEF_RELEASE
62 # ifndef PREPROCESS_XCODE
64 fprintf(stderr, "FILE_DEF_RELEASE should be defined in CXX\n");
65 result = 0;
67 # endif
68 # endif
69 # ifndef TARGET_DEF_RELEASE
71 fprintf(stderr, "TARGET_DEF_RELEASE should be defined in CXX\n");
72 result = 0;
74 # endif
75 # ifndef DIRECTORY_DEF_RELEASE
77 fprintf(stderr, "DIRECTORY_DEF_RELEASE should be defined in CXX\n");
78 result = 0;
80 # endif
81 #endif
82 #ifdef PREPROCESS_DEBUG
83 # ifndef FILE_DEF_DEBUG
84 # ifndef PREPROCESS_XCODE
86 fprintf(stderr, "FILE_DEF_DEBUG should be defined in CXX\n");
87 result = 0;
89 # endif
90 # endif
91 # ifndef TARGET_DEF_DEBUG
93 fprintf(stderr, "TARGET_DEF_DEBUG should be defined in CXX\n");
94 result = 0;
96 # endif
97 # ifndef DIRECTORY_DEF_DEBUG
99 fprintf(stderr, "DIRECTORY_DEF_DEBUG should be defined in CXX\n");
100 result = 0;
102 # endif
103 # ifdef FILE_DEF_RELEASE
105 fprintf(stderr, "FILE_DEF_RELEASE should not be defined in CXX\n");
106 result = 0;
108 # endif
109 # ifdef TARGET_DEF_RELEASE
111 fprintf(stderr, "TARGET_DEF_RELEASE should not be defined in CXX\n");
112 result = 0;
114 # endif
115 # ifdef DIRECTORY_DEF_RELEASE
117 fprintf(stderr, "DIRECTORY_DEF_RELEASE should not be defined in CXX\n");
118 result = 0;
120 # endif
121 #endif
122 #if defined(FILE_DEF_DEBUG) || defined(TARGET_DEF_DEBUG)
123 # if !defined(FILE_DEF_DEBUG) || !defined(TARGET_DEF_DEBUG)
124 # ifndef PREPROCESS_XCODE
126 fprintf(stderr,
127 "FILE_DEF_DEBUG and TARGET_DEF_DEBUG inconsistent in CXX\n");
128 result = 0;
130 # endif
131 # endif
132 # if defined(FILE_DEF_RELEASE) || defined(TARGET_DEF_RELEASE)
134 fprintf(stderr, "DEBUG and RELEASE definitions inconsistent in CXX\n");
135 result = 0;
137 # endif
138 #endif
139 #if defined(FILE_DEF_RELEASE) || defined(TARGET_DEF_RELEASE)
140 # if !defined(FILE_DEF_RELEASE) || !defined(TARGET_DEF_RELEASE)
141 # ifndef PREPROCESS_XCODE
143 fprintf(stderr,
144 "FILE_DEF_RELEASE and TARGET_DEF_RELEASE inconsistent in CXX\n");
145 result = 0;
147 # endif
148 # endif
149 # if defined(FILE_DEF_DEBUG) || defined(TARGET_DEF_DEBUG)
151 fprintf(stderr, "RELEASE and DEBUG definitions inconsistent in CXX\n");
152 result = 0;
154 # endif
155 #endif
156 #ifndef FILE_PATH_DEF
158 fprintf(stderr, "FILE_PATH_DEF not defined in CXX\n");
159 result = 0;
161 #endif
162 #ifndef TARGET_PATH_DEF
164 fprintf(stderr, "TARGET_PATH_DEF not defined in CXX\n");
165 result = 0;
167 #endif
168 #ifndef FILE_DEF
170 fprintf(stderr, "FILE_DEF not defined in CXX\n");
171 result = 0;
173 #endif
174 #ifndef TARGET_DEF
176 fprintf(stderr, "TARGET_DEF not defined in CXX\n");
177 result = 0;
179 #endif
180 #ifndef DIRECTORY_DEF
182 fprintf(stderr, "DIRECTORY_DEF not defined in CXX\n");
183 result = 0;
185 #endif
186 #ifndef OLD_DEF
188 fprintf(stderr, "OLD_DEF not defined in CXX\n");
189 result = 0;
191 #endif
192 #if !defined(OLD_EXPR) || OLD_EXPR != 2
194 fprintf(stderr, "OLD_EXPR id not work in C [%s]\n",
195 TO_STRING(OLD_EXPR));
196 result = 0;
198 #endif
199 return result;
202 int main()
204 int result = 1;
206 if(!check_defines_C())
208 result = 0;
211 if(!check_defines_CXX())
213 result = 0;
216 if(result)
218 printf("All preprocessor definitions are correct.\n");
219 return 0;
221 else
223 return 1;