complex.cxx 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084
  1. #include "Aout.h"
  2. #include "ExtraSources/file1.h"
  3. #include "cmTestConfigure.h"
  4. #include "cmTestConfigureEscape.h"
  5. #include "cmTestGeneratedHeader.h"
  6. #include "cmVersion.h"
  7. #include "file2.h"
  8. #include "sharedFile.h"
  9. extern "C" {
  10. #include "testConly.h"
  11. }
  12. #include <iostream>
  13. #include <string.h>
  14. #include <string>
  15. #include <vector>
  16. #include <stdio.h>
  17. #include <sys/stat.h>
  18. #if !defined(S_ISDIR)
  19. #define S_ISDIR(mode) ((mode)&_S_IFDIR)
  20. #endif
  21. #ifdef COMPLEX_TEST_LINK_STATIC
  22. extern "C" {
  23. int TestLinkGetType();
  24. }
  25. #endif
  26. int cm_passed = 0;
  27. int cm_failed = 0;
  28. // ======================================================================
  29. void cmFailed(const char* Message, const char* m2 = "", const char* m3 = "")
  30. {
  31. std::cout << "FAILED: " << Message << m2 << m3 << "\n";
  32. cm_failed++;
  33. }
  34. // ======================================================================
  35. void cmPassed(const char* Message, const char* m2 = "")
  36. {
  37. std::cout << "Passed: " << Message << m2 << "\n";
  38. cm_passed++;
  39. }
  40. #ifndef COMPLEX_DEFINED_PRE
  41. #error "COMPLEX_DEFINED_PRE not defined!"
  42. #endif
  43. #ifdef COMPLEX_DEFINED
  44. #error "COMPLEX_DEFINED is defined but it should not!"
  45. #endif
  46. #ifndef COMPLEX_DEFINED_POST
  47. #error "COMPLEX_DEFINED_POST not defined!"
  48. #endif
  49. #ifndef CMAKE_IS_REALLY_FUN
  50. #error This is a problem. Looks like ADD_DEFINITIONS and REMOVE_DEFINITIONS does not work
  51. #endif
  52. #if defined(NDEBUG) && !defined(CMAKE_IS_FUN_IN_RELEASE_MODE)
  53. #error Per-configuration directory-level definition not inherited.
  54. #endif
  55. // ======================================================================
  56. void TestAndRemoveFile(const char* filename)
  57. {
  58. struct stat st;
  59. if (stat(filename, &st) < 0) {
  60. cmFailed("Could not find file: ", filename);
  61. } else {
  62. if (remove(filename) < 0) {
  63. cmFailed("Unable to remove file. It does not imply that this test "
  64. "failed, but it *will* be corrupted thereafter if this file is "
  65. "not removed: ",
  66. filename);
  67. } else {
  68. cmPassed("Find and remove file: ", filename);
  69. }
  70. }
  71. }
  72. // ======================================================================
  73. void TestDir(const char* filename)
  74. {
  75. struct stat st;
  76. if (stat(filename, &st) < 0 || !S_ISDIR(st.st_mode)) {
  77. cmFailed("Could not find dir: ", filename);
  78. } else {
  79. cmPassed("Find dir: ", filename);
  80. }
  81. }
  82. // Here is a stupid function that tries to use std::string methods
  83. // so that the dec cxx compiler will instantiate the stuff that
  84. // we are using from the CMakeLib library....
  85. void ForceStringUse()
  86. {
  87. std::vector<std::string> v;
  88. std::vector<std::string> v2;
  89. v = v2;
  90. std::string cachetest = CACHE_TEST_VAR_INTERNAL;
  91. v.push_back(cachetest);
  92. v2 = v;
  93. std::string x(5, 'x');
  94. char buff[5];
  95. x.copy(buff, 1, 0);
  96. x[0] = 'a';
  97. std::string::size_type pos = 0;
  98. x.replace(pos, pos, pos, 'x');
  99. std::string copy = cachetest;
  100. cachetest.find("bar");
  101. cachetest.rfind("bar");
  102. copy.append(cachetest);
  103. copy = cachetest.substr(0, cachetest.size());
  104. }
  105. // defined in testcflags.c
  106. extern "C" int TestCFlags(char* m);
  107. extern "C" int TestTargetCompileFlags(char* m);
  108. #if 0
  109. // defined in Sub1/NameConflictTest.c
  110. extern "C" int NameConflictTest1();
  111. // defined in Sub2/NameConflictTest.c
  112. extern "C" int NameConflictTest2();
  113. #endif
  114. // ======================================================================
  115. int main()
  116. {
  117. #if 0
  118. if(NameConflictTest1() == 0 && NameConflictTest2() == 0)
  119. {
  120. cmPassed("Sub dir with same named source works");
  121. }
  122. else
  123. {
  124. cmFailed("Sub dir with same named source fails");
  125. }
  126. #endif
  127. if (file1() != 1) {
  128. cmFailed("Call to file1 function from library failed.");
  129. } else {
  130. cmPassed("Call to file1 function returned 1.");
  131. }
  132. #ifndef COMPLEX_TARGET_FLAG
  133. cmFailed("COMPILE_FLAGS did not work with SET_TARGET_PROPERTIES");
  134. #else
  135. cmPassed("COMPILE_FLAGS did work with SET_TARGET_PROPERTIES");
  136. #endif
  137. #ifdef ELSEIF_RESULT
  138. cmPassed("ELSEIF did work");
  139. #else
  140. cmFailed("ELSEIF did not work");
  141. #endif
  142. #ifdef CONDITIONAL_PARENTHESES
  143. cmPassed("CONDITIONAL_PARENTHESES did work");
  144. #else
  145. cmFailed("CONDITIONAL_PARENTHESES did not work");
  146. #endif
  147. if (file2() != 1) {
  148. cmFailed("Call to file2 function from library failed.");
  149. } else {
  150. cmPassed("Call to file2 function returned 1.");
  151. }
  152. #ifndef TEST_CXX_FLAGS
  153. cmFailed("CMake CMAKE_CXX_FLAGS is not being passed to the compiler!");
  154. #else
  155. cmPassed("CMake CMAKE_CXX_FLAGS is being passed to the compiler.");
  156. #endif
  157. std::string gen = CMAKE_GENERATOR;
  158. // visual studio is currently broken for c flags
  159. char msg[1024];
  160. if (gen.find("Visual") == gen.npos) {
  161. #ifdef TEST_C_FLAGS
  162. cmFailed(
  163. "CMake CMAKE_C_FLAGS are being passed to c++ files the compiler!");
  164. #else
  165. cmPassed("CMake CMAKE_C_FLAGS are not being passed to c++ files.");
  166. #endif
  167. if (TestCFlags(msg)) {
  168. cmPassed("CMake CMAKE_C_FLAGS are being passed to c files and CXX flags "
  169. "are not.");
  170. } else {
  171. cmFailed(msg);
  172. }
  173. }
  174. if (TestTargetCompileFlags(msg)) {
  175. cmPassed(msg);
  176. } else {
  177. cmFailed(msg);
  178. }
  179. // ----------------------------------------------------------------------
  180. // Test ADD_DEFINITIONS
  181. #ifndef CMAKE_IS_FUN
  182. cmFailed("CMake is not fun, so it is broken and should be fixed.");
  183. #else
  184. cmPassed("CMAKE_IS_FUN is defined.");
  185. #endif
  186. #if defined(CMAKE_ARGV1) && defined(CMAKE_ARGV2) && defined(CMAKE_ARGV3) && \
  187. defined(CMAKE_ARGV4)
  188. cmPassed("Variable args for MACROs are working.");
  189. #else
  190. cmFailed("Variable args for MACROs are failing.");
  191. #endif
  192. // ----------------------------------------------------------------------
  193. // Test GET_SOURCE_FILE_PROPERTY for location
  194. #ifndef CMAKE_FOUND_ACXX
  195. cmFailed("CMake did not get the location of A.cxx correctly");
  196. #else
  197. cmPassed("CMake found A.cxx properly");
  198. #endif
  199. // ----------------------------------------------------------------------
  200. // Test GET_DIRECTORY_PROPERTY for parent
  201. #ifndef CMAKE_FOUND_PARENT
  202. cmFailed("CMake did not get the location of the parent directory properly");
  203. #else
  204. cmPassed("CMake found the parent directory properly");
  205. #endif
  206. // ----------------------------------------------------------------------
  207. // Test GET_DIRECTORY_PROPERTY for listfiles
  208. #ifndef CMAKE_FOUND_LISTFILE_STACK
  209. cmFailed("CMake did not get the listfile stack properly");
  210. #else
  211. cmPassed("CMake found the listfile stack properly");
  212. #endif
  213. // ----------------------------------------------------------------------
  214. // Test SET, VARIABLE_REQUIRES
  215. #ifdef SHOULD_NOT_BE_DEFINED
  216. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED is defined.");
  217. #else
  218. cmPassed("SHOULD_NOT_BE_DEFINED is not defined.");
  219. #endif
  220. #ifndef SHOULD_BE_DEFINED
  221. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED is not defined.\n");
  222. #else
  223. cmPassed("SHOULD_BE_DEFINED is defined.");
  224. #endif
  225. #ifndef ONE_VAR
  226. cmFailed("cmakedefine is broken, ONE_VAR is not defined.");
  227. #else
  228. cmPassed("ONE_VAR is defined.");
  229. #endif
  230. #ifndef ONE_VAR_AND_INDENTED
  231. cmFailed("cmakedefine is broken, ONE_VAR_AND_INDENTED is not defined.");
  232. #else
  233. cmPassed("ONE_VAR_AND_INDENTED is defined.");
  234. #endif
  235. #ifndef ONE_VAR_IS_DEFINED
  236. cmFailed("cmakedefine, SET or VARIABLE_REQUIRES is broken, "
  237. "ONE_VAR_IS_DEFINED is not defined.");
  238. #else
  239. cmPassed("ONE_VAR_IS_DEFINED is defined.");
  240. #endif
  241. #ifdef ZERO_VAR
  242. cmFailed("cmakedefine is broken, ZERO_VAR is defined.");
  243. #else
  244. cmPassed("ZERO_VAR is not defined.");
  245. #endif
  246. #ifdef ZERO_VAR_AND_INDENTED
  247. cmFailed("cmakedefine is broken, ZERO_VAR_AND_INDENTED is defined.");
  248. #else
  249. cmPassed("ZERO_VAR_AND_INDENTED is not defined.");
  250. #endif
  251. #ifndef STRING_VAR
  252. cmFailed("the CONFIGURE_FILE command is broken, STRING_VAR is not defined.");
  253. #else
  254. if (strcmp(STRING_VAR, "CMake is great") != 0) {
  255. cmFailed("the SET or CONFIGURE_FILE command is broken. STRING_VAR == ",
  256. STRING_VAR);
  257. } else {
  258. cmPassed("STRING_VAR == ", STRING_VAR);
  259. }
  260. #endif
  261. // ----------------------------------------------------------------------
  262. // Test various IF/ELSE combinations
  263. #ifdef SHOULD_NOT_BE_DEFINED_NOT
  264. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_NOT is defined.");
  265. #else
  266. cmPassed("SHOULD_NOT_BE_DEFINED_NOT is not defined.");
  267. #endif
  268. #ifndef SHOULD_BE_DEFINED_NOT
  269. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_NOT is not defined.\n");
  270. #else
  271. cmPassed("SHOULD_BE_DEFINED_NOT is defined.");
  272. #endif
  273. #ifdef SHOULD_NOT_BE_DEFINED_NOT2
  274. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_NOT2 is defined.");
  275. #else
  276. cmPassed("SHOULD_NOT_BE_DEFINED_NOT2 is not defined.");
  277. #endif
  278. #ifndef SHOULD_BE_DEFINED_NOT2
  279. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_NOT2 is not defined.\n");
  280. #else
  281. cmPassed("SHOULD_BE_DEFINED_NOT2 is defined.");
  282. #endif
  283. #ifdef SHOULD_NOT_BE_DEFINED_AND
  284. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_AND is defined.");
  285. #else
  286. cmPassed("SHOULD_NOT_BE_DEFINED_AND is not defined.");
  287. #endif
  288. #ifndef SHOULD_BE_DEFINED_AND
  289. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_AND is not defined.\n");
  290. #else
  291. cmPassed("SHOULD_BE_DEFINED_AND is defined.");
  292. #endif
  293. #ifdef SHOULD_NOT_BE_DEFINED_AND2
  294. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_AND2 is defined.");
  295. #else
  296. cmPassed("SHOULD_NOT_BE_DEFINED_AND2 is not defined.");
  297. #endif
  298. #ifndef SHOULD_BE_DEFINED_AND2
  299. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_AND2 is not defined.\n");
  300. #else
  301. cmPassed("SHOULD_BE_DEFINED_AND2 is defined.");
  302. #endif
  303. #ifdef SHOULD_NOT_BE_DEFINED_OR
  304. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_OR is defined.");
  305. #else
  306. cmPassed("SHOULD_NOT_BE_DEFINED_OR is not defined.");
  307. #endif
  308. #ifndef SHOULD_BE_DEFINED_OR
  309. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_OR is not defined.\n");
  310. #else
  311. cmPassed("SHOULD_BE_DEFINED_OR is defined.");
  312. #endif
  313. #ifdef SHOULD_NOT_BE_DEFINED_OR2
  314. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_OR2 is defined.");
  315. #else
  316. cmPassed("SHOULD_NOT_BE_DEFINED_OR2 is not defined.");
  317. #endif
  318. #ifndef SHOULD_BE_DEFINED_OR2
  319. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_OR2 is not defined.\n");
  320. #else
  321. cmPassed("SHOULD_BE_DEFINED_OR2 is defined.");
  322. #endif
  323. #ifdef SHOULD_NOT_BE_DEFINED_MATCHES
  324. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_MATCHES is defined.");
  325. #else
  326. cmPassed("SHOULD_NOT_BE_DEFINED_MATCHES is not defined.");
  327. #endif
  328. #ifndef SHOULD_BE_DEFINED_MATCHES
  329. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_MATCHES is not defined.\n");
  330. #else
  331. cmPassed("SHOULD_BE_DEFINED_MATCHES is defined.");
  332. #endif
  333. #ifdef SHOULD_NOT_BE_DEFINED_MATCHES2
  334. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_MATCHES2 is defined.");
  335. #else
  336. cmPassed("SHOULD_NOT_BE_DEFINED_MATCHES2 is not defined.");
  337. #endif
  338. #ifndef SHOULD_BE_DEFINED_MATCHES2
  339. cmFailed(
  340. "IF or SET is broken, SHOULD_BE_DEFINED_MATCHES2 is not defined.\n");
  341. #else
  342. cmPassed("SHOULD_BE_DEFINED_MATCHES2 is defined.");
  343. #endif
  344. #ifdef SHOULD_NOT_BE_DEFINED_COMMAND
  345. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_COMMAND is defined.");
  346. #else
  347. cmPassed("SHOULD_NOT_BE_DEFINED_COMMAND is not defined.");
  348. #endif
  349. #ifndef SHOULD_BE_DEFINED_COMMAND
  350. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_COMMAND is not defined.\n");
  351. #else
  352. cmPassed("SHOULD_BE_DEFINED_COMMAND is defined.");
  353. #endif
  354. #ifdef SHOULD_NOT_BE_DEFINED_COMMAND2
  355. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_COMMAND2 is defined.");
  356. #else
  357. cmPassed("SHOULD_NOT_BE_DEFINED_COMMAND2 is not defined.");
  358. #endif
  359. #ifndef SHOULD_BE_DEFINED_COMMAND2
  360. cmFailed(
  361. "IF or SET is broken, SHOULD_BE_DEFINED_COMMAND2 is not defined.\n");
  362. #else
  363. cmPassed("SHOULD_BE_DEFINED_COMMAND2 is defined.");
  364. #endif
  365. #ifdef SHOULD_NOT_BE_DEFINED_EXISTS
  366. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_EXISTS is defined.");
  367. #else
  368. cmPassed("SHOULD_NOT_BE_DEFINED_EXISTS is not defined.");
  369. #endif
  370. #ifndef SHOULD_BE_DEFINED_EXISTS
  371. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_EXISTS is not defined.\n");
  372. #else
  373. cmPassed("SHOULD_BE_DEFINED_EXISTS is defined.");
  374. #endif
  375. #ifdef SHOULD_NOT_BE_DEFINED_EXISTS2
  376. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_EXISTS2 is defined.");
  377. #else
  378. cmPassed("SHOULD_NOT_BE_DEFINED_EXISTS2 is not defined.");
  379. #endif
  380. #ifndef SHOULD_BE_DEFINED_EXISTS2
  381. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_EXISTS2 is not defined.\n");
  382. #else
  383. cmPassed("SHOULD_BE_DEFINED_EXISTS2 is defined.");
  384. #endif
  385. #ifndef SHOULD_BE_DEFINED_IS_DIRECTORY
  386. cmFailed(
  387. "IF or SET is broken, SHOULD_BE_DEFINED_IS_DIRECTORY is not defined.\n");
  388. #else
  389. cmPassed("SHOULD_BE_DEFINED_IS_DIRECTORY is defined.");
  390. #endif
  391. #ifndef SHOULD_BE_DEFINED_IS_DIRECTORY2
  392. cmFailed(
  393. "IF or SET is broken, SHOULD_BE_DEFINED_IS_DIRECTORY2 is not defined.\n");
  394. #else
  395. cmPassed("SHOULD_BE_DEFINED_IS_DIRECTORY2 is defined.");
  396. #endif
  397. #ifdef SHOULD_NOT_BE_DEFINED_LESS
  398. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_LESS is defined.");
  399. #else
  400. cmPassed("SHOULD_NOT_BE_DEFINED_LESS is not defined.");
  401. #endif
  402. #ifndef SHOULD_BE_DEFINED_LESS
  403. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_LESS is not defined.\n");
  404. #else
  405. cmPassed("SHOULD_BE_DEFINED_LESS is defined.");
  406. #endif
  407. #ifdef SHOULD_NOT_BE_DEFINED_LESS2
  408. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_LESS2 is defined.");
  409. #else
  410. cmPassed("SHOULD_NOT_BE_DEFINED_LESS2 is not defined.");
  411. #endif
  412. #ifndef SHOULD_BE_DEFINED_LESS2
  413. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_LESS2 is not defined.\n");
  414. #else
  415. cmPassed("SHOULD_BE_DEFINED_LESS2 is defined.");
  416. #endif
  417. #ifdef SHOULD_NOT_BE_DEFINED_GREATER
  418. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_GREATER is defined.");
  419. #else
  420. cmPassed("SHOULD_NOT_BE_DEFINED_GREATER is not defined.");
  421. #endif
  422. #ifndef SHOULD_BE_DEFINED_GREATER
  423. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_GREATER is not defined.\n");
  424. #else
  425. cmPassed("SHOULD_BE_DEFINED_GREATER is defined.");
  426. #endif
  427. #ifdef SHOULD_NOT_BE_DEFINED_GREATER2
  428. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_GREATER2 is defined.");
  429. #else
  430. cmPassed("SHOULD_NOT_BE_DEFINED_GREATER2 is not defined.");
  431. #endif
  432. #ifndef SHOULD_BE_DEFINED_GREATER2
  433. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_GREATER2 is not defined.");
  434. #else
  435. cmPassed("SHOULD_BE_DEFINED_GREATER2 is defined.");
  436. #endif
  437. #ifdef SHOULD_NOT_BE_DEFINED_EQUAL
  438. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_EQUAL is defined.");
  439. #else
  440. cmPassed("SHOULD_NOT_BE_DEFINED_EQUAL is not defined.");
  441. #endif
  442. #ifndef SHOULD_BE_DEFINED_EQUAL
  443. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_EQUAL is not defined.\n");
  444. #else
  445. cmPassed("SHOULD_BE_DEFINED_EQUAL is defined.");
  446. #endif
  447. #ifdef SHOULD_NOT_BE_DEFINED_LESS_EQUAL
  448. cmFailed(
  449. "IF or SET is broken, SHOULD_NOT_BE_DEFINED_LESS_EQUAL is defined.");
  450. #else
  451. cmPassed("SHOULD_NOT_BE_DEFINED_LESS_EQUAL is not defined.");
  452. #endif
  453. #ifndef SHOULD_BE_DEFINED_LESS_EQUAL
  454. cmFailed(
  455. "IF or SET is broken, SHOULD_BE_DEFINED_LESS_EQUAL is not defined.");
  456. #else
  457. cmPassed("SHOULD_BE_DEFINED_LESS_EQUAL is defined.");
  458. #endif
  459. #ifdef SHOULD_NOT_BE_DEFINED_LESS_EQUAL2
  460. cmFailed(
  461. "IF or SET is broken, SHOULD_NOT_BE_DEFINED_LESS_EQUAL2 is defined.");
  462. #else
  463. cmPassed("SHOULD_NOT_BE_DEFINED_LESS_EQUAL2 is not defined.");
  464. #endif
  465. #ifndef SHOULD_BE_DEFINED_LESS_EQUAL2
  466. cmFailed(
  467. "IF or SET is broken, SHOULD_BE_DEFINED_LESS_EQUAL2 is not defined.");
  468. #else
  469. cmPassed("SHOULD_BE_DEFINED_LESS_EQUAL2 is defined.");
  470. #endif
  471. #ifdef SHOULD_NOT_BE_DEFINED_LESS_EQUAL3
  472. cmFailed(
  473. "IF or SET is broken, SHOULD_NOT_BE_DEFINED_LESS_EQUAL3 is defined.");
  474. #else
  475. cmPassed("SHOULD_NOT_BE_DEFINED_LESS_EQUAL3 is not defined.");
  476. #endif
  477. #ifndef SHOULD_BE_DEFINED_LESS_EQUAL3
  478. cmFailed(
  479. "IF or SET is broken, SHOULD_BE_DEFINED_LESS_EQUAL3 is not defined.");
  480. #else
  481. cmPassed("SHOULD_BE_DEFINED_LESS_EQUAL3 is defined.");
  482. #endif
  483. #ifdef SHOULD_NOT_BE_DEFINED_GREATER_EQUAL
  484. cmFailed(
  485. "IF or SET is broken, SHOULD_NOT_BE_DEFINED_GREATER_EQUAL is defined.");
  486. #else
  487. cmPassed("SHOULD_NOT_BE_DEFINED_GREATER_EQUAL is not defined.");
  488. #endif
  489. #ifndef SHOULD_BE_DEFINED_GREATER_EQUAL
  490. cmFailed(
  491. "IF or SET is broken, SHOULD_BE_DEFINED_GREATER_EQUAL is not defined.");
  492. #else
  493. cmPassed("SHOULD_BE_DEFINED_GREATER_EQUAL is defined.");
  494. #endif
  495. #ifdef SHOULD_NOT_BE_DEFINED_GREATER_EQUAL2
  496. cmFailed(
  497. "IF or SET is broken, SHOULD_NOT_BE_DEFINED_GREATER_EQUAL2 is defined.");
  498. #else
  499. cmPassed("SHOULD_NOT_BE_DEFINED_GREATER_EQUAL2 is not defined.");
  500. #endif
  501. #ifndef SHOULD_BE_DEFINED_GREATER_EQUAL2
  502. cmFailed(
  503. "IF or SET is broken, SHOULD_BE_DEFINED_GREATER_EQUAL2 is not defined.");
  504. #else
  505. cmPassed("SHOULD_BE_DEFINED_GREATER_EQUAL2 is defined.");
  506. #endif
  507. #ifdef SHOULD_NOT_BE_DEFINED_GREATER_EQUAL3
  508. cmFailed(
  509. "IF or SET is broken, SHOULD_NOT_BE_DEFINED_GREATER_EQUAL3 is defined.");
  510. #else
  511. cmPassed("SHOULD_NOT_BE_DEFINED_GREATER_EQUAL3 is not defined.");
  512. #endif
  513. #ifndef SHOULD_BE_DEFINED_GREATER_EQUAL3
  514. cmFailed(
  515. "IF or SET is broken, SHOULD_BE_DEFINED_GREATER_EQUAL3 is not defined.");
  516. #else
  517. cmPassed("SHOULD_BE_DEFINED_GREATER_EQUAL3 is defined.");
  518. #endif
  519. #ifdef SHOULD_NOT_BE_DEFINED_STRLESS
  520. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRLESS is defined.");
  521. #else
  522. cmPassed("SHOULD_NOT_BE_DEFINED_STRLESS is not defined.");
  523. #endif
  524. #ifndef SHOULD_BE_DEFINED_STRLESS
  525. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_STRLESS is not defined.");
  526. #else
  527. cmPassed("SHOULD_BE_DEFINED_STRLESS is defined.");
  528. #endif
  529. #ifdef SHOULD_NOT_BE_DEFINED_STRLESS2
  530. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRLESS2 is defined.");
  531. #else
  532. cmPassed("SHOULD_NOT_BE_DEFINED_STRLESS2 is not defined.");
  533. #endif
  534. #ifndef SHOULD_BE_DEFINED_STRLESS2
  535. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_STRLESS2 is not defined.");
  536. #else
  537. cmPassed("SHOULD_BE_DEFINED_STRLESS2 is defined.");
  538. #endif
  539. #ifdef SHOULD_NOT_BE_DEFINED_STRGREATER
  540. cmFailed(
  541. "IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRGREATER is defined.");
  542. #else
  543. cmPassed("SHOULD_NOT_BE_DEFINED_STRGREATER is not defined.");
  544. #endif
  545. #ifndef SHOULD_BE_DEFINED_STRGREATER
  546. cmFailed(
  547. "IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER is not defined.");
  548. #else
  549. cmPassed("SHOULD_BE_DEFINED_STRGREATER is defined.");
  550. #endif
  551. #ifdef SHOULD_NOT_BE_DEFINED_STRGREATER2
  552. cmFailed(
  553. "IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRGREATER2 is defined.");
  554. #else
  555. cmPassed("SHOULD_NOT_BE_DEFINED_STRGREATER2 is not defined.");
  556. #endif
  557. #ifndef SHOULD_BE_DEFINED_STRGREATER2
  558. cmFailed(
  559. "IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER2 is not defined.");
  560. #else
  561. cmPassed("SHOULD_BE_DEFINED_STRGREATER2 is defined.");
  562. #endif
  563. #ifdef SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL
  564. cmFailed(
  565. "IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL is defined.");
  566. #else
  567. cmPassed("SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL is not defined.");
  568. #endif
  569. #ifndef SHOULD_BE_DEFINED_STRLESS_EQUAL
  570. cmFailed(
  571. "IF or SET is broken, SHOULD_BE_DEFINED_STRLESS_EQUAL is not defined.");
  572. #else
  573. cmPassed("SHOULD_BE_DEFINED_STRLESS_EQUAL is defined.");
  574. #endif
  575. #ifdef SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL2
  576. cmFailed(
  577. "IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL2 is defined.");
  578. #else
  579. cmPassed("SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL2 is not defined.");
  580. #endif
  581. #ifndef SHOULD_BE_DEFINED_STRLESS_EQUAL2
  582. cmFailed(
  583. "IF or SET is broken, SHOULD_BE_DEFINED_STRLESS_EQUAL2 is not defined.");
  584. #else
  585. cmPassed("SHOULD_BE_DEFINED_STRLESS_EQUAL2 is defined.");
  586. #endif
  587. #ifdef SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL3
  588. cmFailed(
  589. "IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL3 is defined.");
  590. #else
  591. cmPassed("SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL3 is not defined.");
  592. #endif
  593. #ifndef SHOULD_BE_DEFINED_STRLESS_EQUAL3
  594. cmFailed(
  595. "IF or SET is broken, SHOULD_BE_DEFINED_STRLESS_EQUAL3 is not defined.");
  596. #else
  597. cmPassed("SHOULD_BE_DEFINED_STRLESS_EQUAL3 is defined.");
  598. #endif
  599. #ifdef SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL
  600. cmFailed(
  601. "IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL is defined.");
  602. #else
  603. cmPassed("SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL is not defined.");
  604. #endif
  605. #ifndef SHOULD_BE_DEFINED_STRGREATER_EQUAL
  606. cmFailed(
  607. "IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER_EQUAL is not defined.");
  608. #else
  609. cmPassed("SHOULD_BE_DEFINED_STRGREATER_EQUAL is defined.");
  610. #endif
  611. #ifdef SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL2
  612. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL2 is "
  613. "defined.");
  614. #else
  615. cmPassed("SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL2 is not defined.");
  616. #endif
  617. #ifndef SHOULD_BE_DEFINED_STRGREATER_EQUAL2
  618. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER_EQUAL2 is not "
  619. "defined.");
  620. #else
  621. cmPassed("SHOULD_BE_DEFINED_STRGREATER_EQUAL2 is defined.");
  622. #endif
  623. #ifdef SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL3
  624. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL3 is "
  625. "defined.");
  626. #else
  627. cmPassed("SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL3 is not defined.");
  628. #endif
  629. #ifndef SHOULD_BE_DEFINED_STRGREATER_EQUAL3
  630. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER_EQUAL3 is not "
  631. "defined.");
  632. #else
  633. cmPassed("SHOULD_BE_DEFINED_STRGREATER_EQUAL3 is defined.");
  634. #endif
  635. // ----------------------------------------------------------------------
  636. // Test FOREACH
  637. #ifndef FOREACH_VAR1
  638. cmFailed("the FOREACH, SET or CONFIGURE_FILE command is broken, "
  639. "FOREACH_VAR1 is not defined.");
  640. #else
  641. if (strcmp(FOREACH_VAR1, "VALUE1") != 0) {
  642. cmFailed("the FOREACH, SET or CONFIGURE_FILE command is broken, "
  643. "FOREACH_VAR1 == ",
  644. FOREACH_VAR1);
  645. } else {
  646. cmPassed("FOREACH_VAR1 == ", FOREACH_VAR1);
  647. }
  648. #endif
  649. #ifndef FOREACH_VAR2
  650. cmFailed("the FOREACH, SET or CONFIGURE_FILE command is broken, "
  651. "FOREACH_VAR2 is not defined.");
  652. #else
  653. if (strcmp(FOREACH_VAR2, "VALUE2") != 0) {
  654. cmFailed("the FOREACH, SET or CONFIGURE_FILE command is broken, "
  655. "FOREACH_VAR2 == ",
  656. FOREACH_VAR2);
  657. } else {
  658. cmPassed("FOREACH_VAR2 == ", FOREACH_VAR2);
  659. }
  660. #endif
  661. #ifndef FOREACH_CONCAT
  662. cmFailed("the FOREACH, SET or CONFIGURE_FILE command is broken, "
  663. "FOREACH_CONCAT is not defined.");
  664. #else
  665. if (strcmp(FOREACH_CONCAT, "abcdefg") != 0) {
  666. cmFailed("the FOREACH, SET or CONFIGURE_FILE command is broken, "
  667. "FOREACH_CONCAT == ",
  668. FOREACH_CONCAT);
  669. } else {
  670. cmPassed("FOREACH_CONCAT == ", FOREACH_CONCAT);
  671. }
  672. #endif
  673. // ----------------------------------------------------------------------
  674. // Test WHILE
  675. if (WHILE_VALUE != 1000) {
  676. cmFailed("WHILE command is not working");
  677. } else {
  678. cmPassed("WHILE command is working");
  679. }
  680. // ----------------------------------------------------------------------
  681. // Test LOAD_CACHE
  682. #ifndef CACHE_TEST_VAR1
  683. cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, "
  684. "CACHE_TEST_VAR1 is not defined.");
  685. #else
  686. if (strcmp(CACHE_TEST_VAR1, "foo") != 0) {
  687. cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, "
  688. "CACHE_TEST_VAR1 == ",
  689. CACHE_TEST_VAR1);
  690. } else {
  691. cmPassed("CACHE_TEST_VAR1 == ", CACHE_TEST_VAR1);
  692. }
  693. #endif
  694. #ifndef CACHE_TEST_VAR2
  695. cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, "
  696. "CACHE_TEST_VAR2 is not defined.");
  697. #else
  698. if (strcmp(CACHE_TEST_VAR2, "bar") != 0) {
  699. cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, "
  700. "CACHE_TEST_VAR2 == ",
  701. CACHE_TEST_VAR2);
  702. } else {
  703. cmPassed("CACHE_TEST_VAR2 == ", CACHE_TEST_VAR2);
  704. }
  705. #endif
  706. #ifndef CACHE_TEST_VAR3
  707. cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, "
  708. "CACHE_TEST_VAR3 is not defined.");
  709. #else
  710. if (strcmp(CACHE_TEST_VAR3, "1") != 0) {
  711. cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, "
  712. "CACHE_TEST_VAR3 == ",
  713. CACHE_TEST_VAR3);
  714. } else {
  715. cmPassed("CACHE_TEST_VAR3 == ", CACHE_TEST_VAR3);
  716. }
  717. #endif
  718. #ifdef CACHE_TEST_VAR_EXCLUDED
  719. cmFailed(
  720. "the LOAD_CACHE or CONFIGURE_FILE command or cmakedefine is broken, "
  721. "CACHE_TEST_VAR_EXCLUDED is defined (should not have been loaded).");
  722. #else
  723. cmPassed("CACHE_TEST_VAR_EXCLUDED is not defined.");
  724. #endif
  725. #ifndef CACHE_TEST_VAR_INTERNAL
  726. cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, "
  727. "CACHE_TEST_VAR_INTERNAL is not defined.");
  728. #else
  729. std::string cachetest = CACHE_TEST_VAR_INTERNAL;
  730. if (cachetest != "bar") {
  731. cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, "
  732. "CACHE_TEST_VAR_INTERNAL == ",
  733. CACHE_TEST_VAR_INTERNAL);
  734. } else {
  735. cmPassed("CACHE_TEST_VAR_INTERNAL == ", CACHE_TEST_VAR_INTERNAL);
  736. }
  737. #endif
  738. // ----------------------------------------------------------------------
  739. // Some pre-build/pre-link/post-build custom-commands have been
  740. // attached to the lib (see Library/).
  741. // Each runs ${CREATE_FILE_EXE} which will create a file.
  742. // It also copies that file again using cmake -E.
  743. // Similar rules have been added to this executable.
  744. //
  745. // WARNING: if you run 'complex' manually, this *will* fail, because
  746. // the file was removed the last time 'complex' was run, and it is
  747. // only created during a build.
  748. TestAndRemoveFile("Library/prebuild.txt");
  749. TestAndRemoveFile("Library/prelink.txt");
  750. TestAndRemoveFile("Library/postbuild.txt");
  751. TestAndRemoveFile("Library/postbuild2.txt");
  752. TestAndRemoveFile("Executable/prebuild.txt");
  753. TestAndRemoveFile("Executable/prelink.txt");
  754. TestAndRemoveFile("Executable/postbuild.txt");
  755. TestAndRemoveFile("Executable/postbuild2.txt");
  756. // ----------------------------------------------------------------------
  757. // A custom target has been created (see Library/).
  758. // It runs ${CREATE_FILE_EXE} which will create a file.
  759. //
  760. // WARNING: if you run 'complex' manually, this *will* fail, because
  761. // the file was removed the last time 'complex' was run, and it is
  762. // only created during a build.
  763. TestAndRemoveFile("Library/custom_target1.txt");
  764. // ----------------------------------------------------------------------
  765. // A directory has been created.
  766. TestDir("make_dir");
  767. // ----------------------------------------------------------------------
  768. // Test OUTPUT_REQUIRED_FILES
  769. // The files required by 'complex' have been output to a file.
  770. // The contents of this file is not tested (absolute paths).
  771. //
  772. // WARNING: if you run 'complex' manually, this *will* fail, because
  773. // the file was removed the last time 'complex' was run, and it is
  774. // only created during a build.
  775. TestAndRemoveFile("Executable/Temp/complex-required.txt");
  776. // ----------------------------------------------------------------------
  777. // Test FIND_LIBRARY
  778. #ifndef FIND_DUMMY_LIB
  779. cmFailed("the CONFIGURE_FILE command is broken, "
  780. "FIND_DUMMY_LIB is not defined.");
  781. #else
  782. if (strstr(FIND_DUMMY_LIB, "dummylib") == NULL) {
  783. cmFailed("the FIND_LIBRARY or CONFIGURE_FILE command is broken, "
  784. "FIND_DUMMY_LIB == ",
  785. FIND_DUMMY_LIB);
  786. } else {
  787. cmPassed("FIND_DUMMY_LIB == ", FIND_DUMMY_LIB);
  788. }
  789. #endif
  790. // ----------------------------------------------------------------------
  791. // Test SET_SOURCE_FILES_PROPERTIES
  792. #ifndef FILE_HAS_EXTRA_COMPILE_FLAGS
  793. cmFailed("SET_SOURCE_FILES_PROPERTIES failed at setting "
  794. "FILE_HAS_EXTRA_COMPILE_FLAGS flag");
  795. #else
  796. cmPassed("SET_SOURCE_FILES_PROPERTIES succeeded in setting "
  797. "FILE_HAS_EXTRA_COMPILE_FLAGS flag");
  798. #endif
  799. #if 0 // Disable until implemented everywhere.
  800. #ifndef FILE_DEFINE_STRING
  801. cmFailed("SET_SOURCE_FILES_PROPERTIES failed at setting FILE_DEFINE_STRING flag");
  802. #else
  803. if(strcmp(FILE_DEFINE_STRING, "hello") != 0)
  804. {
  805. cmFailed("SET_SOURCE_FILES_PROPERTIES failed at setting FILE_DEFINE_STRING flag correctly");
  806. }
  807. else
  808. {
  809. cmPassed("SET_SOURCE_FILES_PROPERTIES succeeded in setting FILE_DEFINE_STRING flag");
  810. }
  811. #endif
  812. #endif
  813. #ifndef FILE_HAS_ABSTRACT
  814. cmFailed("SET_SOURCE_FILES_PROPERTIES failed at setting ABSTRACT flag");
  815. #else
  816. cmPassed("SET_SOURCE_FILES_PROPERTIES succeeded in setting ABSTRACT flag");
  817. #endif
  818. #ifndef FILE_HAS_WRAP_EXCLUDE
  819. cmFailed("FILE_HAS_WRAP_EXCLUDE failed at setting WRAP_EXCLUDE flag");
  820. #else
  821. cmPassed("FILE_HAS_WRAP_EXCLUDE succeeded in setting WRAP_EXCLUDE flag");
  822. #endif
  823. #ifndef FILE_COMPILE_FLAGS
  824. cmFailed("the CONFIGURE_FILE command is broken, FILE_COMPILE_FLAGS is not "
  825. "defined.");
  826. #else
  827. if (strcmp(FILE_COMPILE_FLAGS, "-foo -bar") != 0) {
  828. cmFailed("the SET_SOURCE_FILES_PROPERTIES or CONFIGURE_FILE command is "
  829. "broken. FILE_COMPILE_FLAGS == ",
  830. FILE_COMPILE_FLAGS);
  831. } else {
  832. cmPassed(
  833. "SET_SOURCE_FILES_PROPERTIES succeeded in setting extra flags == ",
  834. FILE_COMPILE_FLAGS);
  835. }
  836. #endif
  837. // ----------------------------------------------------------------------
  838. // Test registry (win32)
  839. #if defined(_WIN32) && !defined(__CYGWIN__)
  840. #ifndef REGISTRY_TEST_PATH
  841. cmFailed("the CONFIGURE_FILE command is broken, REGISTRY_TEST_PATH is not "
  842. "defined.");
  843. #else
  844. std::cout << "REGISTRY_TEST_PATH == " << REGISTRY_TEST_PATH << "\n";
  845. if (stricmp(REGISTRY_TEST_PATH, BINARY_DIR "/registry_dir") != 0) {
  846. cmFailed("the 'read registry value' function or CONFIGURE_FILE command is "
  847. "broken. REGISTRY_TEST_PATH == ",
  848. REGISTRY_TEST_PATH, " is not " BINARY_DIR "/registry_dir");
  849. } else {
  850. cmPassed("REGISTRY_TEST_PATH == ", REGISTRY_TEST_PATH);
  851. }
  852. #endif
  853. #endif // defined(_WIN32) && !defined(__CYGWIN__)
  854. if (strcmp(CMAKE_MINIMUM_REQUIRED_VERSION, "2.4") == 0) {
  855. cmPassed("CMAKE_MINIMUM_REQUIRED_VERSION is set to 2.4");
  856. } else {
  857. cmFailed("CMAKE_MINIMUM_REQUIRED_VERSION is not set to the expected 2.4");
  858. }
  859. // ----------------------------------------------------------------------
  860. // Test REMOVE command
  861. if (strcmp("a;b;d", REMOVE_STRING) == 0) {
  862. cmPassed("REMOVE is working");
  863. } else {
  864. cmFailed("REMOVE is not working");
  865. }
  866. // ----------------------------------------------------------------------
  867. // Test SEPARATE_ARGUMENTS
  868. if (strcmp("a;b;c", TEST_SEP) == 0) {
  869. cmPassed("SEPARATE_ARGUMENTS is working");
  870. } else {
  871. cmFailed("SEPARATE_ARGUMENTS is not working");
  872. }
  873. // ----------------------------------------------------------------------
  874. // Test Escape Quotes
  875. if (strcmp("\"hello world\"", STRING_WITH_QUOTES) == 0) {
  876. cmPassed("ESCAPE_QUOTES is working");
  877. } else {
  878. cmFailed("ESCAPE_QUOTES is not working");
  879. }
  880. // ----------------------------------------------------------------------
  881. // Test if IF command inside a FOREACH works.
  882. #if defined(IF_INSIDE_FOREACH_THEN_EXECUTED) && \
  883. !defined(IF_INSIDE_FOREACH_ELSE_EXECUTED)
  884. cmPassed("IF inside a FOREACH block works");
  885. #else
  886. cmFailed("IF inside a FOREACH block is broken");
  887. #endif
  888. #if defined(GENERATED_HEADER_INCLUDED)
  889. cmPassed("Generated header included by non-generated source works.");
  890. #else
  891. cmFailed("Generated header included by non-generated source failed.");
  892. #endif
  893. if (SHOULD_BE_ZERO == 0) {
  894. cmPassed("cmakedefine01 is working for 0");
  895. } else {
  896. cmFailed("cmakedefine01 is not working for 0");
  897. }
  898. if (SHOULD_BE_ONE == 1) {
  899. cmPassed("cmakedefine01 is working for 1");
  900. } else {
  901. cmFailed("cmakedefine01 is not working for 1");
  902. }
  903. if (SHOULD_BE_ZERO_AND_INDENTED == 0) {
  904. cmPassed("cmakedefine01 is working for 0 and indented");
  905. } else {
  906. cmFailed("cmakedefine01 is not working for 0 and indented");
  907. }
  908. if (SHOULD_BE_ONE_AND_INDENTED == 1) {
  909. cmPassed("cmakedefine01 is working for 1 and indented");
  910. } else {
  911. cmFailed("cmakedefine01 is not working for 1 and indented");
  912. }
  913. #ifdef FORCE_TEST
  914. cmFailed("CMake SET CACHE FORCE");
  915. #else
  916. cmPassed("CMake SET CACHE FORCE");
  917. #endif
  918. #ifdef COMPLEX_TEST_LINK_STATIC
  919. if (TestLinkGetType()) {
  920. cmPassed("Link to static over shared worked.");
  921. } else {
  922. cmFailed("Link to static over shared failed.");
  923. }
  924. #endif
  925. #if defined(A_VALUE) && A_VALUE == 10
  926. cmPassed("Single-character executable A worked.");
  927. #else
  928. cmFailed("Single-character executable A failed.");
  929. #endif
  930. // ----------------------------------------------------------------------
  931. // Summary
  932. std::cout << "Passed: " << cm_passed << "\n";
  933. if (cm_failed) {
  934. std::cout << "Failed: " << cm_failed << "\n";
  935. return cm_failed;
  936. }
  937. return 0;
  938. }