complex.cxx 31 KB

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