complex.cxx 31 KB

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