cmCacheManager.cxx 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #include "cmCacheManager.h"
  4. #include <algorithm>
  5. #include <cstdio>
  6. #include <cstring>
  7. #include <sstream>
  8. #include <string>
  9. #include "cmsys/FStream.hxx"
  10. #include "cmsys/Glob.hxx"
  11. #include "cmGeneratedFileStream.h"
  12. #include "cmMessageType.h"
  13. #include "cmMessenger.h"
  14. #include "cmState.h"
  15. #include "cmStringAlgorithms.h"
  16. #include "cmSystemTools.h"
  17. #include "cmVersion.h"
  18. void cmCacheManager::CleanCMakeFiles(const std::string& path)
  19. {
  20. std::string glob = cmStrCat(path, "/CMakeFiles/*.cmake");
  21. cmsys::Glob globIt;
  22. globIt.FindFiles(glob);
  23. std::vector<std::string> files = globIt.GetFiles();
  24. std::for_each(files.begin(), files.end(), cmSystemTools::RemoveFile);
  25. }
  26. bool cmCacheManager::LoadCache(const std::string& path, bool internal,
  27. std::set<std::string>& excludes,
  28. std::set<std::string>& includes)
  29. {
  30. std::string cacheFile = cmStrCat(path, "/CMakeCache.txt");
  31. // clear the old cache, if we are reading in internal values
  32. if (internal) {
  33. this->Cache.clear();
  34. }
  35. if (!cmSystemTools::FileExists(cacheFile)) {
  36. this->CleanCMakeFiles(path);
  37. return false;
  38. }
  39. cmsys::ifstream fin(cacheFile.c_str());
  40. if (!fin) {
  41. return false;
  42. }
  43. const char* realbuffer;
  44. std::string buffer;
  45. std::string entryKey;
  46. unsigned int lineno = 0;
  47. while (fin) {
  48. // Format is key:type=value
  49. std::string helpString;
  50. CacheEntry e;
  51. cmSystemTools::GetLineFromStream(fin, buffer);
  52. lineno++;
  53. realbuffer = buffer.c_str();
  54. while (*realbuffer != '0' &&
  55. (*realbuffer == ' ' || *realbuffer == '\t' || *realbuffer == '\r' ||
  56. *realbuffer == '\n')) {
  57. if (*realbuffer == '\n') {
  58. lineno++;
  59. }
  60. realbuffer++;
  61. }
  62. // skip blank lines and comment lines
  63. if (realbuffer[0] == '#' || realbuffer[0] == 0) {
  64. continue;
  65. }
  66. while (realbuffer[0] == '/' && realbuffer[1] == '/') {
  67. if ((realbuffer[2] == '\\') && (realbuffer[3] == 'n')) {
  68. helpString += '\n';
  69. helpString += &realbuffer[4];
  70. } else {
  71. helpString += &realbuffer[2];
  72. }
  73. cmSystemTools::GetLineFromStream(fin, buffer);
  74. lineno++;
  75. realbuffer = buffer.c_str();
  76. if (!fin) {
  77. continue;
  78. }
  79. }
  80. e.SetProperty("HELPSTRING", helpString.c_str());
  81. if (cmState::ParseCacheEntry(realbuffer, entryKey, e.Value, e.Type)) {
  82. if (excludes.find(entryKey) == excludes.end()) {
  83. // Load internal values if internal is set.
  84. // If the entry is not internal to the cache being loaded
  85. // or if it is in the list of internal entries to be
  86. // imported, load it.
  87. if (internal || (e.Type != cmStateEnums::INTERNAL) ||
  88. (includes.find(entryKey) != includes.end())) {
  89. // If we are loading the cache from another project,
  90. // make all loaded entries internal so that it is
  91. // not visible in the gui
  92. if (!internal) {
  93. e.Type = cmStateEnums::INTERNAL;
  94. helpString = cmStrCat("DO NOT EDIT, ", entryKey,
  95. " loaded from external file. "
  96. "To change this value edit this file: ",
  97. path, "/CMakeCache.txt");
  98. e.SetProperty("HELPSTRING", helpString.c_str());
  99. }
  100. if (!this->ReadPropertyEntry(entryKey, e)) {
  101. e.Initialized = true;
  102. this->Cache[entryKey] = e;
  103. }
  104. }
  105. }
  106. } else {
  107. std::ostringstream error;
  108. error << "Parse error in cache file " << cacheFile << " on line "
  109. << lineno << ". Offending entry: " << realbuffer;
  110. cmSystemTools::Error(error.str());
  111. }
  112. }
  113. this->CacheMajorVersion = 0;
  114. this->CacheMinorVersion = 0;
  115. if (cmProp cmajor =
  116. this->GetInitializedCacheValue("CMAKE_CACHE_MAJOR_VERSION")) {
  117. unsigned int v = 0;
  118. if (sscanf(cmajor->c_str(), "%u", &v) == 1) {
  119. this->CacheMajorVersion = v;
  120. }
  121. if (cmProp cminor =
  122. this->GetInitializedCacheValue("CMAKE_CACHE_MINOR_VERSION")) {
  123. if (sscanf(cminor->c_str(), "%u", &v) == 1) {
  124. this->CacheMinorVersion = v;
  125. }
  126. }
  127. } else {
  128. // CMake version not found in the list file.
  129. // Set as version 0.0
  130. this->AddCacheEntry("CMAKE_CACHE_MINOR_VERSION", "0",
  131. "Minor version of cmake used to create the "
  132. "current loaded cache",
  133. cmStateEnums::INTERNAL);
  134. this->AddCacheEntry("CMAKE_CACHE_MAJOR_VERSION", "0",
  135. "Major version of cmake used to create the "
  136. "current loaded cache",
  137. cmStateEnums::INTERNAL);
  138. }
  139. // check to make sure the cache directory has not
  140. // been moved
  141. cmProp oldDir = this->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR");
  142. if (internal && oldDir) {
  143. std::string currentcwd = path;
  144. std::string oldcwd = *oldDir;
  145. cmSystemTools::ConvertToUnixSlashes(currentcwd);
  146. currentcwd += "/CMakeCache.txt";
  147. oldcwd += "/CMakeCache.txt";
  148. if (!cmSystemTools::SameFile(oldcwd, currentcwd)) {
  149. cmProp dir = this->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR");
  150. std::ostringstream message;
  151. message << "The current CMakeCache.txt directory " << currentcwd
  152. << " is different than the directory " << (dir ? *dir : "")
  153. << " where CMakeCache.txt was created. This may result "
  154. "in binaries being created in the wrong place. If you "
  155. "are not sure, reedit the CMakeCache.txt";
  156. cmSystemTools::Error(message.str());
  157. }
  158. }
  159. this->CacheLoaded = true;
  160. return true;
  161. }
  162. const char* cmCacheManager::PersistentProperties[] = { "ADVANCED", "MODIFIED",
  163. "STRINGS" };
  164. bool cmCacheManager::ReadPropertyEntry(const std::string& entryKey,
  165. const CacheEntry& e)
  166. {
  167. // All property entries are internal.
  168. if (e.Type != cmStateEnums::INTERNAL) {
  169. return false;
  170. }
  171. const char* end = entryKey.c_str() + entryKey.size();
  172. for (const char* p : cmCacheManager::PersistentProperties) {
  173. std::string::size_type plen = strlen(p) + 1;
  174. if (entryKey.size() > plen && *(end - plen) == '-' &&
  175. strcmp(end - plen + 1, p) == 0) {
  176. std::string key = entryKey.substr(0, entryKey.size() - plen);
  177. if (auto entry = this->GetCacheEntry(key)) {
  178. // Store this property on its entry.
  179. entry->SetProperty(p, e.Value.c_str());
  180. } else {
  181. // Create an entry and store the property.
  182. CacheEntry& ne = this->Cache[key];
  183. ne.SetProperty(p, e.Value.c_str());
  184. }
  185. return true;
  186. }
  187. }
  188. return false;
  189. }
  190. void cmCacheManager::WritePropertyEntries(std::ostream& os,
  191. const std::string& entryKey,
  192. const CacheEntry& e,
  193. cmMessenger* messenger) const
  194. {
  195. for (const char* p : cmCacheManager::PersistentProperties) {
  196. if (cmProp value = e.GetProperty(p)) {
  197. std::string helpstring =
  198. cmStrCat(p, " property for variable: ", entryKey);
  199. cmCacheManager::OutputHelpString(os, helpstring);
  200. std::string key = cmStrCat(entryKey, '-', p);
  201. cmCacheManager::OutputKey(os, key);
  202. os << ":INTERNAL=";
  203. cmCacheManager::OutputValue(os, *value);
  204. os << '\n';
  205. cmCacheManager::OutputNewlineTruncationWarning(os, key, *value,
  206. messenger);
  207. }
  208. }
  209. }
  210. bool cmCacheManager::SaveCache(const std::string& path, cmMessenger* messenger)
  211. {
  212. std::string cacheFile = cmStrCat(path, "/CMakeCache.txt");
  213. cmGeneratedFileStream fout(cacheFile);
  214. fout.SetCopyIfDifferent(true);
  215. if (!fout) {
  216. cmSystemTools::Error("Unable to open cache file for save. " + cacheFile);
  217. cmSystemTools::ReportLastSystemError("");
  218. return false;
  219. }
  220. // before writing the cache, update the version numbers
  221. // to the
  222. this->AddCacheEntry("CMAKE_CACHE_MAJOR_VERSION",
  223. std::to_string(cmVersion::GetMajorVersion()).c_str(),
  224. "Major version of cmake used to create the "
  225. "current loaded cache",
  226. cmStateEnums::INTERNAL);
  227. this->AddCacheEntry("CMAKE_CACHE_MINOR_VERSION",
  228. std::to_string(cmVersion::GetMinorVersion()).c_str(),
  229. "Minor version of cmake used to create the "
  230. "current loaded cache",
  231. cmStateEnums::INTERNAL);
  232. this->AddCacheEntry("CMAKE_CACHE_PATCH_VERSION",
  233. std::to_string(cmVersion::GetPatchVersion()).c_str(),
  234. "Patch version of cmake used to create the "
  235. "current loaded cache",
  236. cmStateEnums::INTERNAL);
  237. // Let us store the current working directory so that if somebody
  238. // Copies it, he will not be surprised
  239. std::string currentcwd = path;
  240. if (currentcwd[0] >= 'A' && currentcwd[0] <= 'Z' && currentcwd[1] == ':') {
  241. // Cast added to avoid compiler warning. Cast is ok because
  242. // value is guaranteed to fit in char by the above if...
  243. currentcwd[0] = static_cast<char>(currentcwd[0] - 'A' + 'a');
  244. }
  245. cmSystemTools::ConvertToUnixSlashes(currentcwd);
  246. this->AddCacheEntry("CMAKE_CACHEFILE_DIR", currentcwd.c_str(),
  247. "This is the directory where this CMakeCache.txt"
  248. " was created",
  249. cmStateEnums::INTERNAL);
  250. /* clang-format off */
  251. fout << "# This is the CMakeCache file.\n"
  252. "# For build in directory: " << currentcwd << "\n"
  253. "# It was generated by CMake: "
  254. << cmSystemTools::GetCMakeCommand()
  255. << "\n"
  256. "# You can edit this file to change values found and used by cmake."
  257. "\n"
  258. "# If you do not want to change any of the values, simply exit the "
  259. "editor.\n"
  260. "# If you do want to change a value, simply edit, save, and exit "
  261. "the editor.\n"
  262. "# The syntax for the file is as follows:\n"
  263. "# KEY:TYPE=VALUE\n"
  264. "# KEY is the name of a variable in the cache.\n"
  265. "# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!."
  266. "\n"
  267. "# VALUE is the current value for the KEY.\n"
  268. "\n"
  269. "########################\n"
  270. "# EXTERNAL cache entries\n"
  271. "########################\n"
  272. "\n";
  273. /* clang-format on */
  274. for (auto const& i : this->Cache) {
  275. CacheEntry const& ce = i.second;
  276. cmStateEnums::CacheEntryType t = ce.Type;
  277. if (!ce.Initialized) {
  278. /*
  279. // This should be added in, but is not for now.
  280. cmSystemTools::Error("Cache entry \"" + i.first + "\" is uninitialized");
  281. */
  282. } else if (t != cmStateEnums::INTERNAL) {
  283. // Format is key:type=value
  284. if (cmProp help = ce.GetProperty("HELPSTRING")) {
  285. cmCacheManager::OutputHelpString(fout, *help);
  286. } else {
  287. cmCacheManager::OutputHelpString(fout, "Missing description");
  288. }
  289. cmCacheManager::OutputKey(fout, i.first);
  290. fout << ':' << cmState::CacheEntryTypeToString(t) << '=';
  291. cmCacheManager::OutputValue(fout, ce.Value);
  292. fout << '\n';
  293. cmCacheManager::OutputNewlineTruncationWarning(fout, i.first, ce.Value,
  294. messenger);
  295. fout << '\n';
  296. }
  297. }
  298. fout << "\n"
  299. "########################\n"
  300. "# INTERNAL cache entries\n"
  301. "########################\n"
  302. "\n";
  303. for (auto const& i : this->Cache) {
  304. if (!i.second.Initialized) {
  305. continue;
  306. }
  307. cmStateEnums::CacheEntryType t = i.second.GetType();
  308. this->WritePropertyEntries(fout, i.first, i.second, messenger);
  309. if (t == cmStateEnums::INTERNAL) {
  310. // Format is key:type=value
  311. if (cmProp help = i.second.GetProperty("HELPSTRING")) {
  312. cmCacheManager::OutputHelpString(fout, *help);
  313. }
  314. cmCacheManager::OutputKey(fout, i.first);
  315. fout << ':' << cmState::CacheEntryTypeToString(t) << '=';
  316. cmCacheManager::OutputValue(fout, i.second.GetValue());
  317. fout << '\n';
  318. cmCacheManager::OutputNewlineTruncationWarning(
  319. fout, i.first, i.second.GetValue(), messenger);
  320. }
  321. }
  322. fout << '\n';
  323. fout.Close();
  324. std::string checkCacheFile = cmStrCat(path, "/CMakeFiles");
  325. cmSystemTools::MakeDirectory(checkCacheFile);
  326. checkCacheFile += "/cmake.check_cache";
  327. cmsys::ofstream checkCache(checkCacheFile.c_str());
  328. if (!checkCache) {
  329. cmSystemTools::Error("Unable to open check cache file for write. " +
  330. checkCacheFile);
  331. return false;
  332. }
  333. checkCache << "# This file is generated by cmake for dependency checking "
  334. "of the CMakeCache.txt file\n";
  335. return true;
  336. }
  337. bool cmCacheManager::DeleteCache(const std::string& path)
  338. {
  339. std::string cacheFile = path;
  340. cmSystemTools::ConvertToUnixSlashes(cacheFile);
  341. std::string cmakeFiles = cacheFile;
  342. cacheFile += "/CMakeCache.txt";
  343. if (cmSystemTools::FileExists(cacheFile)) {
  344. cmSystemTools::RemoveFile(cacheFile);
  345. // now remove the files in the CMakeFiles directory
  346. // this cleans up language cache files
  347. cmakeFiles += "/CMakeFiles";
  348. if (cmSystemTools::FileIsDirectory(cmakeFiles)) {
  349. cmSystemTools::RemoveADirectory(cmakeFiles);
  350. }
  351. }
  352. return true;
  353. }
  354. void cmCacheManager::OutputKey(std::ostream& fout, std::string const& key)
  355. {
  356. // support : in key name by double quoting
  357. const char* q =
  358. (key.find(':') != std::string::npos || cmHasLiteralPrefix(key, "//"))
  359. ? "\""
  360. : "";
  361. fout << q << key << q;
  362. }
  363. void cmCacheManager::OutputValue(std::ostream& fout, std::string const& value)
  364. {
  365. // look for and truncate newlines
  366. std::string::size_type newline = value.find('\n');
  367. if (newline != std::string::npos) {
  368. std::string truncated = value.substr(0, newline);
  369. OutputValueNoNewlines(fout, truncated);
  370. } else {
  371. OutputValueNoNewlines(fout, value);
  372. }
  373. }
  374. void cmCacheManager::OutputValueNoNewlines(std::ostream& fout,
  375. std::string const& value)
  376. {
  377. // if value has trailing space or tab, enclose it in single quotes
  378. if (!value.empty() && (value.back() == ' ' || value.back() == '\t')) {
  379. fout << '\'' << value << '\'';
  380. } else {
  381. fout << value;
  382. }
  383. }
  384. void cmCacheManager::OutputHelpString(std::ostream& fout,
  385. const std::string& helpString)
  386. {
  387. std::string::size_type end = helpString.size();
  388. if (end == 0) {
  389. return;
  390. }
  391. std::string oneLine;
  392. std::string::size_type pos = 0;
  393. for (std::string::size_type i = 0; i <= end; i++) {
  394. if ((i == end) || (helpString[i] == '\n') ||
  395. ((i - pos >= 60) && (helpString[i] == ' '))) {
  396. fout << "//";
  397. if (helpString[pos] == '\n') {
  398. pos++;
  399. fout << "\\n";
  400. }
  401. oneLine = helpString.substr(pos, i - pos);
  402. fout << oneLine << '\n';
  403. pos = i;
  404. }
  405. }
  406. }
  407. void cmCacheManager::OutputWarningComment(std::ostream& fout,
  408. std::string const& message,
  409. bool wrapSpaces)
  410. {
  411. std::string::size_type end = message.size();
  412. std::string oneLine;
  413. std::string::size_type pos = 0;
  414. for (std::string::size_type i = 0; i <= end; i++) {
  415. if ((i == end) || (message[i] == '\n') ||
  416. ((i - pos >= 60) && (message[i] == ' ') && wrapSpaces)) {
  417. fout << "# ";
  418. if (message[pos] == '\n') {
  419. pos++;
  420. fout << "\\n";
  421. }
  422. oneLine = message.substr(pos, i - pos);
  423. fout << oneLine << '\n';
  424. pos = i;
  425. }
  426. }
  427. }
  428. void cmCacheManager::OutputNewlineTruncationWarning(std::ostream& fout,
  429. std::string const& key,
  430. std::string const& value,
  431. cmMessenger* messenger)
  432. {
  433. if (value.find('\n') != std::string::npos) {
  434. if (messenger) {
  435. std::string message =
  436. cmStrCat("Value of ", key, " contained a newline; truncating");
  437. messenger->IssueMessage(MessageType::WARNING, message);
  438. }
  439. std::string comment =
  440. cmStrCat("WARNING: Value of ", key,
  441. " contained a newline and was truncated. Original value:");
  442. OutputWarningComment(fout, comment, true);
  443. OutputWarningComment(fout, value, false);
  444. }
  445. }
  446. void cmCacheManager::RemoveCacheEntry(const std::string& key)
  447. {
  448. this->Cache.erase(key);
  449. }
  450. cmCacheManager::CacheEntry* cmCacheManager::GetCacheEntry(
  451. const std::string& key)
  452. {
  453. auto i = this->Cache.find(key);
  454. if (i != this->Cache.end()) {
  455. return &i->second;
  456. }
  457. return nullptr;
  458. }
  459. const cmCacheManager::CacheEntry* cmCacheManager::GetCacheEntry(
  460. const std::string& key) const
  461. {
  462. auto i = this->Cache.find(key);
  463. if (i != this->Cache.end()) {
  464. return &i->second;
  465. }
  466. return nullptr;
  467. }
  468. cmProp cmCacheManager::GetInitializedCacheValue(const std::string& key) const
  469. {
  470. if (auto entry = this->GetCacheEntry(key)) {
  471. if (entry->Initialized) {
  472. return &entry->GetValue();
  473. }
  474. }
  475. return nullptr;
  476. }
  477. void cmCacheManager::PrintCache(std::ostream& out) const
  478. {
  479. out << "=================================================\n"
  480. "CMakeCache Contents:\n";
  481. for (auto const& i : this->Cache) {
  482. if (i.second.Type != cmStateEnums::INTERNAL) {
  483. out << i.first << " = " << i.second.Value << '\n';
  484. }
  485. }
  486. out << "\n\n"
  487. "To change values in the CMakeCache, \n"
  488. "edit CMakeCache.txt in your output directory.\n"
  489. "=================================================\n";
  490. }
  491. void cmCacheManager::AddCacheEntry(const std::string& key, const char* value,
  492. const char* helpString,
  493. cmStateEnums::CacheEntryType type)
  494. {
  495. CacheEntry& e = this->Cache[key];
  496. e.SetValue(value);
  497. e.Type = type;
  498. // make sure we only use unix style paths
  499. if (type == cmStateEnums::FILEPATH || type == cmStateEnums::PATH) {
  500. if (e.Value.find(';') != std::string::npos) {
  501. std::vector<std::string> paths = cmExpandedList(e.Value);
  502. const char* sep = "";
  503. e.Value = "";
  504. for (std::string& i : paths) {
  505. cmSystemTools::ConvertToUnixSlashes(i);
  506. e.Value += sep;
  507. e.Value += i;
  508. sep = ";";
  509. }
  510. } else {
  511. cmSystemTools::ConvertToUnixSlashes(e.Value);
  512. }
  513. }
  514. e.SetProperty("HELPSTRING",
  515. helpString
  516. ? helpString
  517. : "(This variable does not exist and should not be used)");
  518. }
  519. void cmCacheManager::CacheEntry::SetValue(const char* value)
  520. {
  521. if (value) {
  522. this->Value = value;
  523. this->Initialized = true;
  524. } else {
  525. this->Value.clear();
  526. }
  527. }
  528. std::vector<std::string> cmCacheManager::CacheEntry::GetPropertyList() const
  529. {
  530. return this->Properties.GetKeys();
  531. }
  532. cmProp cmCacheManager::CacheEntry::GetProperty(const std::string& prop) const
  533. {
  534. if (prop == "TYPE") {
  535. return &cmState::CacheEntryTypeToString(this->Type);
  536. }
  537. if (prop == "VALUE") {
  538. return &this->Value;
  539. }
  540. return this->Properties.GetPropertyValue(prop);
  541. }
  542. bool cmCacheManager::CacheEntry::GetPropertyAsBool(
  543. const std::string& prop) const
  544. {
  545. return cmIsOn(this->GetProperty(prop));
  546. }
  547. void cmCacheManager::CacheEntry::SetProperty(const std::string& prop,
  548. const char* value)
  549. {
  550. if (prop == "TYPE") {
  551. this->Type = cmState::StringToCacheEntryType(value ? value : "STRING");
  552. } else if (prop == "VALUE") {
  553. this->Value = value ? value : "";
  554. } else {
  555. this->Properties.SetProperty(prop, value);
  556. }
  557. }
  558. void cmCacheManager::CacheEntry::SetProperty(const std::string& p, bool v)
  559. {
  560. this->SetProperty(p, v ? "ON" : "OFF");
  561. }
  562. void cmCacheManager::CacheEntry::AppendProperty(const std::string& prop,
  563. const std::string& value,
  564. bool asString)
  565. {
  566. if (prop == "TYPE") {
  567. this->Type =
  568. cmState::StringToCacheEntryType(!value.empty() ? value : "STRING");
  569. } else if (prop == "VALUE") {
  570. if (!value.empty()) {
  571. if (!this->Value.empty() && !asString) {
  572. this->Value += ";";
  573. }
  574. this->Value += value;
  575. }
  576. } else {
  577. this->Properties.AppendProperty(prop, value, asString);
  578. }
  579. }