complex.cxx 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068
  1. #include "cmTestConfigure.h"
  2. #include "cmTestConfigureEscape.h"
  3. #include "cmTestGeneratedHeader.h"
  4. #include "cmVersion.h"
  5. #include "Aout.h"
  6. #include "ExtraSources/file1.h"
  7. #include "file2.h"
  8. #include "sharedFile.h"
  9. extern "C" {
  10. #include "testConly.h"
  11. }
  12. #include <iostream>
  13. #include <string>
  14. #include <vector>
  15. #include <stdio.h>
  16. #include <string.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(COMPLEX_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
  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. #ifdef ZERO_VAR
  236. cmFailed("cmakedefine is broken, ZERO_VAR is defined.");
  237. #else
  238. cmPassed("ZERO_VAR is not defined.");
  239. #endif
  240. #ifdef ZERO_VAR_AND_INDENTED
  241. cmFailed("cmakedefine is broken, ZERO_VAR_AND_INDENTED is defined.");
  242. #else
  243. cmPassed("ZERO_VAR_AND_INDENTED is not defined.");
  244. #endif
  245. #ifndef STRING_VAR
  246. cmFailed("the CONFIGURE_FILE command is broken, STRING_VAR is not defined.");
  247. #else
  248. if (strcmp(STRING_VAR, "CMake is great") != 0) {
  249. cmFailed("the SET or CONFIGURE_FILE command is broken. STRING_VAR == ",
  250. STRING_VAR);
  251. } else {
  252. cmPassed("STRING_VAR == ", STRING_VAR);
  253. }
  254. #endif
  255. // ----------------------------------------------------------------------
  256. // Test various IF/ELSE combinations
  257. #ifdef SHOULD_NOT_BE_DEFINED_NOT
  258. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_NOT is defined.");
  259. #else
  260. cmPassed("SHOULD_NOT_BE_DEFINED_NOT is not defined.");
  261. #endif
  262. #ifndef SHOULD_BE_DEFINED_NOT
  263. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_NOT is not defined.\n");
  264. #else
  265. cmPassed("SHOULD_BE_DEFINED_NOT is defined.");
  266. #endif
  267. #ifdef SHOULD_NOT_BE_DEFINED_NOT2
  268. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_NOT2 is defined.");
  269. #else
  270. cmPassed("SHOULD_NOT_BE_DEFINED_NOT2 is not defined.");
  271. #endif
  272. #ifndef SHOULD_BE_DEFINED_NOT2
  273. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_NOT2 is not defined.\n");
  274. #else
  275. cmPassed("SHOULD_BE_DEFINED_NOT2 is defined.");
  276. #endif
  277. #ifdef SHOULD_NOT_BE_DEFINED_AND
  278. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_AND is defined.");
  279. #else
  280. cmPassed("SHOULD_NOT_BE_DEFINED_AND is not defined.");
  281. #endif
  282. #ifndef SHOULD_BE_DEFINED_AND
  283. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_AND is not defined.\n");
  284. #else
  285. cmPassed("SHOULD_BE_DEFINED_AND is defined.");
  286. #endif
  287. #ifdef SHOULD_NOT_BE_DEFINED_AND2
  288. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_AND2 is defined.");
  289. #else
  290. cmPassed("SHOULD_NOT_BE_DEFINED_AND2 is not defined.");
  291. #endif
  292. #ifndef SHOULD_BE_DEFINED_AND2
  293. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_AND2 is not defined.\n");
  294. #else
  295. cmPassed("SHOULD_BE_DEFINED_AND2 is defined.");
  296. #endif
  297. #ifdef SHOULD_NOT_BE_DEFINED_OR
  298. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_OR is defined.");
  299. #else
  300. cmPassed("SHOULD_NOT_BE_DEFINED_OR is not defined.");
  301. #endif
  302. #ifndef SHOULD_BE_DEFINED_OR
  303. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_OR is not defined.\n");
  304. #else
  305. cmPassed("SHOULD_BE_DEFINED_OR is defined.");
  306. #endif
  307. #ifdef SHOULD_NOT_BE_DEFINED_OR2
  308. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_OR2 is defined.");
  309. #else
  310. cmPassed("SHOULD_NOT_BE_DEFINED_OR2 is not defined.");
  311. #endif
  312. #ifndef SHOULD_BE_DEFINED_OR2
  313. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_OR2 is not defined.\n");
  314. #else
  315. cmPassed("SHOULD_BE_DEFINED_OR2 is defined.");
  316. #endif
  317. #ifdef SHOULD_NOT_BE_DEFINED_MATCHES
  318. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_MATCHES is defined.");
  319. #else
  320. cmPassed("SHOULD_NOT_BE_DEFINED_MATCHES is not defined.");
  321. #endif
  322. #ifndef SHOULD_BE_DEFINED_MATCHES
  323. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_MATCHES is not defined.\n");
  324. #else
  325. cmPassed("SHOULD_BE_DEFINED_MATCHES is defined.");
  326. #endif
  327. #ifdef SHOULD_NOT_BE_DEFINED_MATCHES2
  328. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_MATCHES2 is defined.");
  329. #else
  330. cmPassed("SHOULD_NOT_BE_DEFINED_MATCHES2 is not defined.");
  331. #endif
  332. #ifndef SHOULD_BE_DEFINED_MATCHES2
  333. cmFailed(
  334. "IF or SET is broken, SHOULD_BE_DEFINED_MATCHES2 is not defined.\n");
  335. #else
  336. cmPassed("SHOULD_BE_DEFINED_MATCHES2 is defined.");
  337. #endif
  338. #ifdef SHOULD_NOT_BE_DEFINED_COMMAND
  339. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_COMMAND is defined.");
  340. #else
  341. cmPassed("SHOULD_NOT_BE_DEFINED_COMMAND is not defined.");
  342. #endif
  343. #ifndef SHOULD_BE_DEFINED_COMMAND
  344. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_COMMAND is not defined.\n");
  345. #else
  346. cmPassed("SHOULD_BE_DEFINED_COMMAND is defined.");
  347. #endif
  348. #ifdef SHOULD_NOT_BE_DEFINED_COMMAND2
  349. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_COMMAND2 is defined.");
  350. #else
  351. cmPassed("SHOULD_NOT_BE_DEFINED_COMMAND2 is not defined.");
  352. #endif
  353. #ifndef SHOULD_BE_DEFINED_COMMAND2
  354. cmFailed(
  355. "IF or SET is broken, SHOULD_BE_DEFINED_COMMAND2 is not defined.\n");
  356. #else
  357. cmPassed("SHOULD_BE_DEFINED_COMMAND2 is defined.");
  358. #endif
  359. #ifdef SHOULD_NOT_BE_DEFINED_EXISTS
  360. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_EXISTS is defined.");
  361. #else
  362. cmPassed("SHOULD_NOT_BE_DEFINED_EXISTS is not defined.");
  363. #endif
  364. #ifndef SHOULD_BE_DEFINED_EXISTS
  365. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_EXISTS is not defined.\n");
  366. #else
  367. cmPassed("SHOULD_BE_DEFINED_EXISTS is defined.");
  368. #endif
  369. #ifdef SHOULD_NOT_BE_DEFINED_EXISTS2
  370. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_EXISTS2 is defined.");
  371. #else
  372. cmPassed("SHOULD_NOT_BE_DEFINED_EXISTS2 is not defined.");
  373. #endif
  374. #ifndef SHOULD_BE_DEFINED_EXISTS2
  375. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_EXISTS2 is not defined.\n");
  376. #else
  377. cmPassed("SHOULD_BE_DEFINED_EXISTS2 is defined.");
  378. #endif
  379. #ifndef SHOULD_BE_DEFINED_IS_DIRECTORY
  380. cmFailed(
  381. "IF or SET is broken, SHOULD_BE_DEFINED_IS_DIRECTORY is not defined.\n");
  382. #else
  383. cmPassed("SHOULD_BE_DEFINED_IS_DIRECTORY is defined.");
  384. #endif
  385. #ifndef SHOULD_BE_DEFINED_IS_DIRECTORY2
  386. cmFailed(
  387. "IF or SET is broken, SHOULD_BE_DEFINED_IS_DIRECTORY2 is not defined.\n");
  388. #else
  389. cmPassed("SHOULD_BE_DEFINED_IS_DIRECTORY2 is defined.");
  390. #endif
  391. #ifdef SHOULD_NOT_BE_DEFINED_LESS
  392. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_LESS is defined.");
  393. #else
  394. cmPassed("SHOULD_NOT_BE_DEFINED_LESS is not defined.");
  395. #endif
  396. #ifndef SHOULD_BE_DEFINED_LESS
  397. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_LESS is not defined.\n");
  398. #else
  399. cmPassed("SHOULD_BE_DEFINED_LESS is defined.");
  400. #endif
  401. #ifdef SHOULD_NOT_BE_DEFINED_LESS2
  402. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_LESS2 is defined.");
  403. #else
  404. cmPassed("SHOULD_NOT_BE_DEFINED_LESS2 is not defined.");
  405. #endif
  406. #ifndef SHOULD_BE_DEFINED_LESS2
  407. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_LESS2 is not defined.\n");
  408. #else
  409. cmPassed("SHOULD_BE_DEFINED_LESS2 is defined.");
  410. #endif
  411. #ifdef SHOULD_NOT_BE_DEFINED_GREATER
  412. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_GREATER is defined.");
  413. #else
  414. cmPassed("SHOULD_NOT_BE_DEFINED_GREATER is not defined.");
  415. #endif
  416. #ifndef SHOULD_BE_DEFINED_GREATER
  417. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_GREATER is not defined.\n");
  418. #else
  419. cmPassed("SHOULD_BE_DEFINED_GREATER is defined.");
  420. #endif
  421. #ifdef SHOULD_NOT_BE_DEFINED_GREATER2
  422. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_GREATER2 is defined.");
  423. #else
  424. cmPassed("SHOULD_NOT_BE_DEFINED_GREATER2 is not defined.");
  425. #endif
  426. #ifndef SHOULD_BE_DEFINED_GREATER2
  427. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_GREATER2 is not defined.");
  428. #else
  429. cmPassed("SHOULD_BE_DEFINED_GREATER2 is defined.");
  430. #endif
  431. #ifdef SHOULD_NOT_BE_DEFINED_EQUAL
  432. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_EQUAL is defined.");
  433. #else
  434. cmPassed("SHOULD_NOT_BE_DEFINED_EQUAL is not defined.");
  435. #endif
  436. #ifndef SHOULD_BE_DEFINED_EQUAL
  437. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_EQUAL is not defined.\n");
  438. #else
  439. cmPassed("SHOULD_BE_DEFINED_EQUAL is defined.");
  440. #endif
  441. #ifdef SHOULD_NOT_BE_DEFINED_LESS_EQUAL
  442. cmFailed(
  443. "IF or SET is broken, SHOULD_NOT_BE_DEFINED_LESS_EQUAL is defined.");
  444. #else
  445. cmPassed("SHOULD_NOT_BE_DEFINED_LESS_EQUAL is not defined.");
  446. #endif
  447. #ifndef SHOULD_BE_DEFINED_LESS_EQUAL
  448. cmFailed(
  449. "IF or SET is broken, SHOULD_BE_DEFINED_LESS_EQUAL is not defined.");
  450. #else
  451. cmPassed("SHOULD_BE_DEFINED_LESS_EQUAL is defined.");
  452. #endif
  453. #ifdef SHOULD_NOT_BE_DEFINED_LESS_EQUAL2
  454. cmFailed(
  455. "IF or SET is broken, SHOULD_NOT_BE_DEFINED_LESS_EQUAL2 is defined.");
  456. #else
  457. cmPassed("SHOULD_NOT_BE_DEFINED_LESS_EQUAL2 is not defined.");
  458. #endif
  459. #ifndef SHOULD_BE_DEFINED_LESS_EQUAL2
  460. cmFailed(
  461. "IF or SET is broken, SHOULD_BE_DEFINED_LESS_EQUAL2 is not defined.");
  462. #else
  463. cmPassed("SHOULD_BE_DEFINED_LESS_EQUAL2 is defined.");
  464. #endif
  465. #ifdef SHOULD_NOT_BE_DEFINED_LESS_EQUAL3
  466. cmFailed(
  467. "IF or SET is broken, SHOULD_NOT_BE_DEFINED_LESS_EQUAL3 is defined.");
  468. #else
  469. cmPassed("SHOULD_NOT_BE_DEFINED_LESS_EQUAL3 is not defined.");
  470. #endif
  471. #ifndef SHOULD_BE_DEFINED_LESS_EQUAL3
  472. cmFailed(
  473. "IF or SET is broken, SHOULD_BE_DEFINED_LESS_EQUAL3 is not defined.");
  474. #else
  475. cmPassed("SHOULD_BE_DEFINED_LESS_EQUAL3 is defined.");
  476. #endif
  477. #ifdef SHOULD_NOT_BE_DEFINED_GREATER_EQUAL
  478. cmFailed(
  479. "IF or SET is broken, SHOULD_NOT_BE_DEFINED_GREATER_EQUAL is defined.");
  480. #else
  481. cmPassed("SHOULD_NOT_BE_DEFINED_GREATER_EQUAL is not defined.");
  482. #endif
  483. #ifndef SHOULD_BE_DEFINED_GREATER_EQUAL
  484. cmFailed(
  485. "IF or SET is broken, SHOULD_BE_DEFINED_GREATER_EQUAL is not defined.");
  486. #else
  487. cmPassed("SHOULD_BE_DEFINED_GREATER_EQUAL is defined.");
  488. #endif
  489. #ifdef SHOULD_NOT_BE_DEFINED_GREATER_EQUAL2
  490. cmFailed(
  491. "IF or SET is broken, SHOULD_NOT_BE_DEFINED_GREATER_EQUAL2 is defined.");
  492. #else
  493. cmPassed("SHOULD_NOT_BE_DEFINED_GREATER_EQUAL2 is not defined.");
  494. #endif
  495. #ifndef SHOULD_BE_DEFINED_GREATER_EQUAL2
  496. cmFailed(
  497. "IF or SET is broken, SHOULD_BE_DEFINED_GREATER_EQUAL2 is not defined.");
  498. #else
  499. cmPassed("SHOULD_BE_DEFINED_GREATER_EQUAL2 is defined.");
  500. #endif
  501. #ifdef SHOULD_NOT_BE_DEFINED_GREATER_EQUAL3
  502. cmFailed(
  503. "IF or SET is broken, SHOULD_NOT_BE_DEFINED_GREATER_EQUAL3 is defined.");
  504. #else
  505. cmPassed("SHOULD_NOT_BE_DEFINED_GREATER_EQUAL3 is not defined.");
  506. #endif
  507. #ifndef SHOULD_BE_DEFINED_GREATER_EQUAL3
  508. cmFailed(
  509. "IF or SET is broken, SHOULD_BE_DEFINED_GREATER_EQUAL3 is not defined.");
  510. #else
  511. cmPassed("SHOULD_BE_DEFINED_GREATER_EQUAL3 is defined.");
  512. #endif
  513. #ifdef SHOULD_NOT_BE_DEFINED_STRLESS
  514. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRLESS is defined.");
  515. #else
  516. cmPassed("SHOULD_NOT_BE_DEFINED_STRLESS is not defined.");
  517. #endif
  518. #ifndef SHOULD_BE_DEFINED_STRLESS
  519. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_STRLESS is not defined.");
  520. #else
  521. cmPassed("SHOULD_BE_DEFINED_STRLESS is defined.");
  522. #endif
  523. #ifdef SHOULD_NOT_BE_DEFINED_STRLESS2
  524. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRLESS2 is defined.");
  525. #else
  526. cmPassed("SHOULD_NOT_BE_DEFINED_STRLESS2 is not defined.");
  527. #endif
  528. #ifndef SHOULD_BE_DEFINED_STRLESS2
  529. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_STRLESS2 is not defined.");
  530. #else
  531. cmPassed("SHOULD_BE_DEFINED_STRLESS2 is defined.");
  532. #endif
  533. #ifdef SHOULD_NOT_BE_DEFINED_STRGREATER
  534. cmFailed(
  535. "IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRGREATER is defined.");
  536. #else
  537. cmPassed("SHOULD_NOT_BE_DEFINED_STRGREATER is not defined.");
  538. #endif
  539. #ifndef SHOULD_BE_DEFINED_STRGREATER
  540. cmFailed(
  541. "IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER is not defined.");
  542. #else
  543. cmPassed("SHOULD_BE_DEFINED_STRGREATER is defined.");
  544. #endif
  545. #ifdef SHOULD_NOT_BE_DEFINED_STRGREATER2
  546. cmFailed(
  547. "IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRGREATER2 is defined.");
  548. #else
  549. cmPassed("SHOULD_NOT_BE_DEFINED_STRGREATER2 is not defined.");
  550. #endif
  551. #ifndef SHOULD_BE_DEFINED_STRGREATER2
  552. cmFailed(
  553. "IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER2 is not defined.");
  554. #else
  555. cmPassed("SHOULD_BE_DEFINED_STRGREATER2 is defined.");
  556. #endif
  557. #ifdef SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL
  558. cmFailed(
  559. "IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL is defined.");
  560. #else
  561. cmPassed("SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL is not defined.");
  562. #endif
  563. #ifndef SHOULD_BE_DEFINED_STRLESS_EQUAL
  564. cmFailed(
  565. "IF or SET is broken, SHOULD_BE_DEFINED_STRLESS_EQUAL is not defined.");
  566. #else
  567. cmPassed("SHOULD_BE_DEFINED_STRLESS_EQUAL is defined.");
  568. #endif
  569. #ifdef SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL2
  570. cmFailed(
  571. "IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL2 is defined.");
  572. #else
  573. cmPassed("SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL2 is not defined.");
  574. #endif
  575. #ifndef SHOULD_BE_DEFINED_STRLESS_EQUAL2
  576. cmFailed(
  577. "IF or SET is broken, SHOULD_BE_DEFINED_STRLESS_EQUAL2 is not defined.");
  578. #else
  579. cmPassed("SHOULD_BE_DEFINED_STRLESS_EQUAL2 is defined.");
  580. #endif
  581. #ifdef SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL3
  582. cmFailed(
  583. "IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL3 is defined.");
  584. #else
  585. cmPassed("SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL3 is not defined.");
  586. #endif
  587. #ifndef SHOULD_BE_DEFINED_STRLESS_EQUAL3
  588. cmFailed(
  589. "IF or SET is broken, SHOULD_BE_DEFINED_STRLESS_EQUAL3 is not defined.");
  590. #else
  591. cmPassed("SHOULD_BE_DEFINED_STRLESS_EQUAL3 is defined.");
  592. #endif
  593. #ifdef SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL
  594. cmFailed(
  595. "IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL is defined.");
  596. #else
  597. cmPassed("SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL is not defined.");
  598. #endif
  599. #ifndef SHOULD_BE_DEFINED_STRGREATER_EQUAL
  600. cmFailed(
  601. "IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER_EQUAL is not defined.");
  602. #else
  603. cmPassed("SHOULD_BE_DEFINED_STRGREATER_EQUAL is defined.");
  604. #endif
  605. #ifdef SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL2
  606. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL2 is "
  607. "defined.");
  608. #else
  609. cmPassed("SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL2 is not defined.");
  610. #endif
  611. #ifndef SHOULD_BE_DEFINED_STRGREATER_EQUAL2
  612. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER_EQUAL2 is not "
  613. "defined.");
  614. #else
  615. cmPassed("SHOULD_BE_DEFINED_STRGREATER_EQUAL2 is defined.");
  616. #endif
  617. #ifdef SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL3
  618. cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL3 is "
  619. "defined.");
  620. #else
  621. cmPassed("SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL3 is not defined.");
  622. #endif
  623. #ifndef SHOULD_BE_DEFINED_STRGREATER_EQUAL3
  624. cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER_EQUAL3 is not "
  625. "defined.");
  626. #else
  627. cmPassed("SHOULD_BE_DEFINED_STRGREATER_EQUAL3 is defined.");
  628. #endif
  629. // ----------------------------------------------------------------------
  630. // Test FOREACH
  631. #ifndef FOREACH_VAR1
  632. cmFailed("the FOREACH, SET or CONFIGURE_FILE command is broken, "
  633. "FOREACH_VAR1 is not defined.");
  634. #else
  635. if (strcmp(FOREACH_VAR1, "VALUE1") != 0) {
  636. cmFailed("the FOREACH, SET or CONFIGURE_FILE command is broken, "
  637. "FOREACH_VAR1 == ",
  638. FOREACH_VAR1);
  639. } else {
  640. cmPassed("FOREACH_VAR1 == ", FOREACH_VAR1);
  641. }
  642. #endif
  643. #ifndef FOREACH_VAR2
  644. cmFailed("the FOREACH, SET or CONFIGURE_FILE command is broken, "
  645. "FOREACH_VAR2 is not defined.");
  646. #else
  647. if (strcmp(FOREACH_VAR2, "VALUE2") != 0) {
  648. cmFailed("the FOREACH, SET or CONFIGURE_FILE command is broken, "
  649. "FOREACH_VAR2 == ",
  650. FOREACH_VAR2);
  651. } else {
  652. cmPassed("FOREACH_VAR2 == ", FOREACH_VAR2);
  653. }
  654. #endif
  655. #ifndef FOREACH_CONCAT
  656. cmFailed("the FOREACH, SET or CONFIGURE_FILE command is broken, "
  657. "FOREACH_CONCAT is not defined.");
  658. #else
  659. if (strcmp(FOREACH_CONCAT, "abcdefg") != 0) {
  660. cmFailed("the FOREACH, SET or CONFIGURE_FILE command is broken, "
  661. "FOREACH_CONCAT == ",
  662. FOREACH_CONCAT);
  663. } else {
  664. cmPassed("FOREACH_CONCAT == ", FOREACH_CONCAT);
  665. }
  666. #endif
  667. // ----------------------------------------------------------------------
  668. // Test WHILE
  669. if (WHILE_VALUE != 1000) {
  670. cmFailed("WHILE command is not working");
  671. } else {
  672. cmPassed("WHILE command is working");
  673. }
  674. // ----------------------------------------------------------------------
  675. // Test LOAD_CACHE
  676. #ifndef CACHE_TEST_VAR1
  677. cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, "
  678. "CACHE_TEST_VAR1 is not defined.");
  679. #else
  680. if (strcmp(CACHE_TEST_VAR1, "foo") != 0) {
  681. cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, "
  682. "CACHE_TEST_VAR1 == ",
  683. CACHE_TEST_VAR1);
  684. } else {
  685. cmPassed("CACHE_TEST_VAR1 == ", CACHE_TEST_VAR1);
  686. }
  687. #endif
  688. #ifndef CACHE_TEST_VAR2
  689. cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, "
  690. "CACHE_TEST_VAR2 is not defined.");
  691. #else
  692. if (strcmp(CACHE_TEST_VAR2, "bar") != 0) {
  693. cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, "
  694. "CACHE_TEST_VAR2 == ",
  695. CACHE_TEST_VAR2);
  696. } else {
  697. cmPassed("CACHE_TEST_VAR2 == ", CACHE_TEST_VAR2);
  698. }
  699. #endif
  700. #ifndef CACHE_TEST_VAR3
  701. cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, "
  702. "CACHE_TEST_VAR3 is not defined.");
  703. #else
  704. if (strcmp(CACHE_TEST_VAR3, "1") != 0) {
  705. cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, "
  706. "CACHE_TEST_VAR3 == ",
  707. CACHE_TEST_VAR3);
  708. } else {
  709. cmPassed("CACHE_TEST_VAR3 == ", CACHE_TEST_VAR3);
  710. }
  711. #endif
  712. #ifdef CACHE_TEST_VAR_EXCLUDED
  713. cmFailed(
  714. "the LOAD_CACHE or CONFIGURE_FILE command or cmakedefine is broken, "
  715. "CACHE_TEST_VAR_EXCLUDED is defined (should not have been loaded).");
  716. #else
  717. cmPassed("CACHE_TEST_VAR_EXCLUDED is not defined.");
  718. #endif
  719. #ifndef CACHE_TEST_VAR_INTERNAL
  720. cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, "
  721. "CACHE_TEST_VAR_INTERNAL is not defined.");
  722. #else
  723. std::string cachetest = CACHE_TEST_VAR_INTERNAL;
  724. if (cachetest != "bar") {
  725. cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, "
  726. "CACHE_TEST_VAR_INTERNAL == ",
  727. CACHE_TEST_VAR_INTERNAL);
  728. } else {
  729. cmPassed("CACHE_TEST_VAR_INTERNAL == ", CACHE_TEST_VAR_INTERNAL);
  730. }
  731. #endif
  732. // ----------------------------------------------------------------------
  733. // Some pre-build/pre-link/post-build custom-commands have been
  734. // attached to the lib (see Library/).
  735. // Each runs ${CREATE_FILE_EXE} which will create a file.
  736. // It also copies that file again using cmake -E.
  737. // Similar rules have been added to this executable.
  738. //
  739. // WARNING: if you run 'complex' manually, this *will* fail, because
  740. // the file was removed the last time 'complex' was run, and it is
  741. // only created during a build.
  742. TestAndRemoveFile("Library/prebuild.txt");
  743. TestAndRemoveFile("Library/prelink.txt");
  744. TestAndRemoveFile("Library/postbuild.txt");
  745. TestAndRemoveFile("Library/postbuild2.txt");
  746. TestAndRemoveFile("Executable/prebuild.txt");
  747. TestAndRemoveFile("Executable/prelink.txt");
  748. TestAndRemoveFile("Executable/postbuild.txt");
  749. TestAndRemoveFile("Executable/postbuild2.txt");
  750. // ----------------------------------------------------------------------
  751. // A custom target has been created (see Library/).
  752. // It runs ${CREATE_FILE_EXE} which will create a file.
  753. //
  754. // WARNING: if you run 'complex' manually, this *will* fail, because
  755. // the file was removed the last time 'complex' was run, and it is
  756. // only created during a build.
  757. TestAndRemoveFile("Library/custom_target1.txt");
  758. // ----------------------------------------------------------------------
  759. // A directory has been created.
  760. TestDir("make_dir");
  761. // ----------------------------------------------------------------------
  762. // Test FIND_LIBRARY
  763. #ifndef FIND_DUMMY_LIB
  764. cmFailed("the CONFIGURE_FILE command is broken, "
  765. "FIND_DUMMY_LIB is not defined.");
  766. #else
  767. if (strstr(FIND_DUMMY_LIB, "dummylib") == NULL) {
  768. cmFailed("the FIND_LIBRARY or CONFIGURE_FILE command is broken, "
  769. "FIND_DUMMY_LIB == ",
  770. FIND_DUMMY_LIB);
  771. } else {
  772. cmPassed("FIND_DUMMY_LIB == ", FIND_DUMMY_LIB);
  773. }
  774. #endif
  775. // ----------------------------------------------------------------------
  776. // Test SET_SOURCE_FILES_PROPERTIES
  777. #ifndef FILE_HAS_EXTRA_COMPILE_FLAGS
  778. cmFailed("SET_SOURCE_FILES_PROPERTIES failed at setting "
  779. "FILE_HAS_EXTRA_COMPILE_FLAGS flag");
  780. #else
  781. cmPassed("SET_SOURCE_FILES_PROPERTIES succeeded in setting "
  782. "FILE_HAS_EXTRA_COMPILE_FLAGS flag");
  783. #endif
  784. #if 0 // Disable until implemented everywhere.
  785. # ifndef FILE_DEFINE_STRING
  786. cmFailed("SET_SOURCE_FILES_PROPERTIES failed at setting FILE_DEFINE_STRING flag");
  787. # else
  788. if(strcmp(FILE_DEFINE_STRING, "hello") != 0)
  789. {
  790. cmFailed("SET_SOURCE_FILES_PROPERTIES failed at setting FILE_DEFINE_STRING flag correctly");
  791. }
  792. else
  793. {
  794. cmPassed("SET_SOURCE_FILES_PROPERTIES succeeded in setting FILE_DEFINE_STRING flag");
  795. }
  796. # endif
  797. #endif
  798. #ifndef FILE_HAS_ABSTRACT
  799. cmFailed("SET_SOURCE_FILES_PROPERTIES failed at setting ABSTRACT flag");
  800. #else
  801. cmPassed("SET_SOURCE_FILES_PROPERTIES succeeded in setting ABSTRACT flag");
  802. #endif
  803. #ifndef FILE_HAS_WRAP_EXCLUDE
  804. cmFailed("FILE_HAS_WRAP_EXCLUDE failed at setting WRAP_EXCLUDE flag");
  805. #else
  806. cmPassed("FILE_HAS_WRAP_EXCLUDE succeeded in setting WRAP_EXCLUDE flag");
  807. #endif
  808. #ifndef FILE_COMPILE_FLAGS
  809. cmFailed("the CONFIGURE_FILE command is broken, FILE_COMPILE_FLAGS is not "
  810. "defined.");
  811. #else
  812. if (strcmp(FILE_COMPILE_FLAGS, "-foo -bar") != 0) {
  813. cmFailed("the SET_SOURCE_FILES_PROPERTIES or CONFIGURE_FILE command is "
  814. "broken. FILE_COMPILE_FLAGS == ",
  815. FILE_COMPILE_FLAGS);
  816. } else {
  817. cmPassed(
  818. "SET_SOURCE_FILES_PROPERTIES succeeded in setting extra flags == ",
  819. FILE_COMPILE_FLAGS);
  820. }
  821. #endif
  822. // ----------------------------------------------------------------------
  823. // Test registry (win32)
  824. #if defined(_WIN32) && !defined(__CYGWIN__)
  825. # ifndef REGISTRY_TEST_PATH
  826. cmFailed("the CONFIGURE_FILE command is broken, REGISTRY_TEST_PATH is not "
  827. "defined.");
  828. # else
  829. std::cout << "REGISTRY_TEST_PATH == " << REGISTRY_TEST_PATH << "\n";
  830. if (stricmp(REGISTRY_TEST_PATH, BINARY_DIR "/registry_dir") != 0) {
  831. cmFailed("the 'read registry value' function or CONFIGURE_FILE command is "
  832. "broken. REGISTRY_TEST_PATH == ",
  833. REGISTRY_TEST_PATH, " is not " BINARY_DIR "/registry_dir");
  834. } else {
  835. cmPassed("REGISTRY_TEST_PATH == ", REGISTRY_TEST_PATH);
  836. }
  837. # endif
  838. #endif // defined(_WIN32) && !defined(__CYGWIN__)
  839. if (strcmp(CMAKE_MINIMUM_REQUIRED_VERSION, "3.10") == 0) {
  840. cmPassed("CMAKE_MINIMUM_REQUIRED_VERSION is set to 3.10");
  841. } else {
  842. cmFailed("CMAKE_MINIMUM_REQUIRED_VERSION is not set to the expected 2.4");
  843. }
  844. // ----------------------------------------------------------------------
  845. // Test REMOVE command
  846. if (strcmp("a;b;d", REMOVE_STRING) == 0) {
  847. cmPassed("REMOVE is working");
  848. } else {
  849. cmFailed("REMOVE is not working");
  850. }
  851. // ----------------------------------------------------------------------
  852. // Test SEPARATE_ARGUMENTS
  853. if (strcmp("a;b;c", TEST_SEP) == 0) {
  854. cmPassed("SEPARATE_ARGUMENTS is working");
  855. } else {
  856. cmFailed("SEPARATE_ARGUMENTS is not working");
  857. }
  858. // ----------------------------------------------------------------------
  859. // Test Escape Quotes
  860. if (strcmp("\"hello world\"", STRING_WITH_QUOTES) == 0) {
  861. cmPassed("ESCAPE_QUOTES is working");
  862. } else {
  863. cmFailed("ESCAPE_QUOTES is not working");
  864. }
  865. // ----------------------------------------------------------------------
  866. // Test if IF command inside a FOREACH works.
  867. #if defined(IF_INSIDE_FOREACH_THEN_EXECUTED) && \
  868. !defined(IF_INSIDE_FOREACH_ELSE_EXECUTED)
  869. cmPassed("IF inside a FOREACH block works");
  870. #else
  871. cmFailed("IF inside a FOREACH block is broken");
  872. #endif
  873. #if defined(GENERATED_HEADER_INCLUDED)
  874. cmPassed("Generated header included by non-generated source works.");
  875. #else
  876. cmFailed("Generated header included by non-generated source failed.");
  877. #endif
  878. if (SHOULD_BE_ZERO == 0) {
  879. cmPassed("cmakedefine01 is working for 0");
  880. } else {
  881. cmFailed("cmakedefine01 is not working for 0");
  882. }
  883. if (SHOULD_BE_ONE == 1) {
  884. cmPassed("cmakedefine01 is working for 1");
  885. } else {
  886. cmFailed("cmakedefine01 is not working for 1");
  887. }
  888. if (SHOULD_BE_ZERO_AND_INDENTED == 0) {
  889. cmPassed("cmakedefine01 is working for 0 and indented");
  890. } else {
  891. cmFailed("cmakedefine01 is not working for 0 and indented");
  892. }
  893. if (SHOULD_BE_ONE_AND_INDENTED == 1) {
  894. cmPassed("cmakedefine01 is working for 1 and indented");
  895. } else {
  896. cmFailed("cmakedefine01 is not working for 1 and indented");
  897. }
  898. #ifdef FORCE_TEST
  899. cmFailed("CMake SET CACHE FORCE");
  900. #else
  901. cmPassed("CMake SET CACHE FORCE");
  902. #endif
  903. #ifdef COMPLEX_TEST_LINK_STATIC
  904. if (TestLinkGetType()) {
  905. cmPassed("Link to static over shared worked.");
  906. } else {
  907. cmFailed("Link to static over shared failed.");
  908. }
  909. #endif
  910. #if defined(A_VALUE) && A_VALUE == 10
  911. cmPassed("Single-character executable A worked.");
  912. #else
  913. cmFailed("Single-character executable A failed.");
  914. #endif
  915. // ----------------------------------------------------------------------
  916. // Summary
  917. std::cout << "Passed: " << cm_passed << "\n";
  918. if (cm_failed) {
  919. std::cout << "Failed: " << cm_failed << "\n";
  920. return cm_failed;
  921. }
  922. return 0;
  923. }