cmCacheManager.cxx 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675
  1. /*=========================================================================
  2. Program: Insight Segmentation & Registration Toolkit
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Insight Consortium. All rights reserved.
  8. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #include "cmCacheManager.h"
  14. #include "cmSystemTools.h"
  15. #include "cmCacheManager.h"
  16. #include "cmMakefile.h"
  17. #include "cmRegularExpression.h"
  18. #include "stdio.h"
  19. #if defined(_WIN32) || defined(__CYGWIN__)
  20. # include <windows.h>
  21. #endif // _WIN32
  22. const char* cmCacheManagerTypes[] =
  23. { "BOOL",
  24. "PATH",
  25. "FILEPATH",
  26. "STRING",
  27. "INTERNAL",
  28. "STATIC",
  29. "UNINITIALIZED",
  30. 0
  31. };
  32. cmCacheManager::CacheEntryType cmCacheManager::StringToType(const char* s)
  33. {
  34. int i = 0;
  35. while(cmCacheManagerTypes[i])
  36. {
  37. if(strcmp(s, cmCacheManagerTypes[i]) == 0)
  38. {
  39. return static_cast<CacheEntryType>(i);
  40. }
  41. ++i;
  42. }
  43. return STRING;
  44. }
  45. bool cmCacheManager::LoadCache(cmMakefile* mf)
  46. {
  47. return this->LoadCache(mf->GetHomeOutputDirectory());
  48. }
  49. bool cmCacheManager::LoadCache(const char* path)
  50. {
  51. return this->LoadCache(path,true);
  52. }
  53. bool cmCacheManager::LoadCache(const char* path,
  54. bool internal)
  55. {
  56. std::set<std::string> emptySet;
  57. return this->LoadCache(path, internal, emptySet, emptySet);
  58. }
  59. bool cmCacheManager::ParseEntry(const char* entry,
  60. std::string& var,
  61. std::string& value,
  62. CacheEntryType& type)
  63. {
  64. // input line is: key:type=value
  65. cmRegularExpression reg("^([^:]*):([^=]*)=(.*[^\t ]|[\t ]*)[\t ]*$");
  66. // input line is: "key":type=value
  67. cmRegularExpression regQuoted("^\"([^\"]*)\":([^=]*)=(.*[^\t ]|[\t ]*)[\t ]*$");
  68. bool flag = false;
  69. if(regQuoted.find(entry))
  70. {
  71. var = regQuoted.match(1);
  72. type = cmCacheManager::StringToType(regQuoted.match(2).c_str());
  73. value = regQuoted.match(3);
  74. flag = true;
  75. }
  76. else if (reg.find(entry))
  77. {
  78. var = reg.match(1);
  79. type = cmCacheManager::StringToType(reg.match(2).c_str());
  80. value = reg.match(3);
  81. flag = true;
  82. }
  83. // if value is enclosed in single quotes ('foo') then remove them
  84. // it is used to enclose trailing space or tab
  85. if (flag &&
  86. value.size() >= 2 &&
  87. value[0] == '\'' &&
  88. value[value.size() - 1] == '\'')
  89. {
  90. value = value.substr(1,
  91. value.size() - 2);
  92. }
  93. return flag;
  94. }
  95. bool cmCacheManager::LoadCache(const char* path,
  96. bool internal,
  97. std::set<std::string>& excludes,
  98. std::set<std::string>& includes)
  99. {
  100. std::string cacheFile = path;
  101. cacheFile += "/CMakeCache.txt";
  102. // clear the old cache, if we are reading in internal values
  103. if ( internal )
  104. {
  105. m_Cache.clear();
  106. }
  107. std::ifstream fin(cacheFile.c_str());
  108. if(!fin)
  109. {
  110. return false;
  111. }
  112. const int bsize = 4096;
  113. char buffer[bsize];
  114. char *realbuffer;
  115. // input line is: key:type=value
  116. cmRegularExpression reg("^([^:]*):([^=]*)=(.*[^\t ]|[\t ]*)[\t ]*$");
  117. // input line is: "key":type=value
  118. cmRegularExpression regQuoted("^\"([^\"]*)\":([^=]*)=(.*[^\t ]|[\t ]*)[\t ]*$");
  119. std::string entryKey;
  120. while(fin)
  121. {
  122. // Format is key:type=value
  123. CacheEntry e;
  124. fin.getline(buffer, bsize);
  125. realbuffer = buffer;
  126. while(*realbuffer != '0' &&
  127. (*realbuffer == ' ' ||
  128. *realbuffer == '\t' ||
  129. *realbuffer == '\n'))
  130. {
  131. realbuffer++;
  132. }
  133. // skip blank lines and comment lines
  134. if(realbuffer[0] == '#' || realbuffer[0] == 0)
  135. {
  136. continue;
  137. }
  138. while(realbuffer[0] == '/' && realbuffer[1] == '/')
  139. {
  140. e.m_Properties["HELPSTRING"] += &realbuffer[2];
  141. fin.getline(realbuffer, bsize);
  142. if(!fin)
  143. {
  144. continue;
  145. }
  146. }
  147. if(cmCacheManager::ParseEntry(realbuffer, entryKey, e.m_Value, e.m_Type))
  148. {
  149. if ( excludes.find(entryKey) == excludes.end() )
  150. {
  151. // Load internal values if internal is set.
  152. // If the entry is not internal to the cache being loaded
  153. // or if it is in the list of internal entries to be
  154. // imported, load it.
  155. if ( internal || (e.m_Type != INTERNAL) ||
  156. (includes.find(entryKey) != includes.end()) )
  157. {
  158. // If we are loading the cache from another project,
  159. // make all loaded entries internal so that it is
  160. // not visible in the gui
  161. if (!internal)
  162. {
  163. e.m_Type = INTERNAL;
  164. e.m_Properties["HELPSTRING"] = "DO NOT EDIT, ";
  165. e.m_Properties["HELPSTRING"] += entryKey;
  166. e.m_Properties["HELPSTRING"] += " loaded from external file. "
  167. "To change this value edit this file: ";
  168. e.m_Properties["HELPSTRING"] += path;
  169. e.m_Properties["HELPSTRING"] += "/CMakeCache.txt" ;
  170. }
  171. if ( e.m_Type == cmCacheManager::INTERNAL &&
  172. (entryKey.size() > strlen("-ADVANCED")) &&
  173. strcmp(entryKey.c_str() + (entryKey.size() - strlen("-ADVANCED")),
  174. "-ADVANCED") == 0 )
  175. {
  176. std::string akey = entryKey.substr(0, (entryKey.size() - strlen("-ADVANCED")));
  177. cmCacheManager::CacheIterator it = this->GetCacheIterator(akey.c_str());
  178. if ( it.IsAtEnd() )
  179. {
  180. e.m_Type = cmCacheManager::UNINITIALIZED;
  181. m_Cache[akey] = e;
  182. }
  183. else
  184. {
  185. it.SetProperty("ADVANCED", true);
  186. }
  187. }
  188. else
  189. {
  190. m_Cache[entryKey] = e;
  191. }
  192. }
  193. }
  194. }
  195. else
  196. {
  197. cmSystemTools::Error("Parse error in cache file ", cacheFile.c_str(),
  198. ". Offending entry: ", realbuffer);
  199. }
  200. }
  201. // if CMAKE version not found in the list file
  202. // add them as version 0.0
  203. if(!this->GetCacheValue("CMAKE_CACHE_MINOR_VERSION"))
  204. {
  205. this->AddCacheEntry("CMAKE_CACHE_MINOR_VERSION", "0",
  206. "Minor version of cmake used to create the "
  207. "current loaded cache", cmCacheManager::INTERNAL);
  208. this->AddCacheEntry("CMAKE_CACHE_MAJOR_VERSION", "0",
  209. "Major version of cmake used to create the "
  210. "current loaded cache", cmCacheManager::INTERNAL);
  211. }
  212. // check to make sure the cache directory has not
  213. // been moved
  214. if ( internal && this->GetCacheValue("CMAKE_CACHEFILE_DIR") )
  215. {
  216. std::string currentcwd = path;
  217. std::string oldcwd = this->GetCacheValue("CMAKE_CACHEFILE_DIR");
  218. cmSystemTools::ConvertToUnixSlashes(currentcwd);
  219. currentcwd += "/CMakeCache.txt";
  220. oldcwd += "/CMakeCache.txt";
  221. if(!cmSystemTools::SameFile(oldcwd.c_str(), currentcwd.c_str()))
  222. {
  223. std::string message =
  224. std::string("The current CMakeCache.txt directory ") +
  225. currentcwd + std::string(" is different than the directory ") +
  226. std::string(this->GetCacheValue("CMAKE_CACHEFILE_DIR")) +
  227. std::string(" where CMackeCache.txt was created. This may result "
  228. "in binaries being created in the wrong place. If you "
  229. "are not sure, reedit the CMakeCache.txt");
  230. cmSystemTools::Error(message.c_str());
  231. }
  232. }
  233. return true;
  234. }
  235. bool cmCacheManager::SaveCache(cmMakefile* mf)
  236. {
  237. return this->SaveCache(mf->GetHomeOutputDirectory());
  238. }
  239. bool cmCacheManager::SaveCache(const char* path)
  240. {
  241. std::string cacheFile = path;
  242. cacheFile += "/CMakeCache.txt";
  243. std::string tempFile = cacheFile;
  244. tempFile += ".tmp";
  245. std::ofstream fout(tempFile.c_str());
  246. if(!fout)
  247. {
  248. cmSystemTools::Error("Unable to open cache file for save. ",
  249. cacheFile.c_str());
  250. return false;
  251. }
  252. // before writting the cache, update the version numbers
  253. // to the
  254. char temp[1024];
  255. sprintf(temp, "%d", cmMakefile::GetMinorVersion());
  256. this->AddCacheEntry("CMAKE_CACHE_MINOR_VERSION", temp,
  257. "Minor version of cmake used to create the "
  258. "current loaded cache", cmCacheManager::INTERNAL);
  259. sprintf(temp, "%d", cmMakefile::GetMajorVersion());
  260. this->AddCacheEntry("CMAKE_CACHE_MAJOR_VERSION", temp,
  261. "Major version of cmake used to create the "
  262. "current loaded cache", cmCacheManager::INTERNAL);
  263. // Let us store the current working directory so that if somebody
  264. // Copies it, he will not be surprised
  265. std::string currentcwd = path;
  266. if ( currentcwd[0] >= 'A' && currentcwd[0] <= 'Z' &&
  267. currentcwd[1] == ':' )
  268. {
  269. currentcwd[0] = currentcwd[0] - 'A' + 'a';
  270. }
  271. cmSystemTools::ConvertToUnixSlashes(currentcwd);
  272. this->AddCacheEntry("CMAKE_CACHEFILE_DIR", currentcwd.c_str(),
  273. "This is the directory where this CMakeCahe.txt"
  274. " was created", cmCacheManager::INTERNAL);
  275. fout << "# This is the CMakeCache file.\n"
  276. << "# For build in directory: " << currentcwd << "\n"
  277. << "# You can edit this file to change values found and used by cmake.\n"
  278. << "# If you do not want to change any of the values, simply exit the editor.\n"
  279. << "# If you do want to change a value, simply edit, save, and exit the editor.\n"
  280. << "# The syntax for the file is as follows:\n"
  281. << "# KEY:TYPE=VALUE\n"
  282. << "# KEY is the name of a varible in the cache.\n"
  283. << "# TYPE is a hint to GUI's for the type of VALUE, DO NOT EDIT TYPE!.\n"
  284. << "# VALUE is the current value for the KEY.\n\n";
  285. fout << "########################\n";
  286. fout << "# EXTERNAL cache entries\n";
  287. fout << "########################\n";
  288. fout << "\n";
  289. for( std::map<cmStdString, CacheEntry>::const_iterator i = m_Cache.begin();
  290. i != m_Cache.end(); ++i)
  291. {
  292. const CacheEntry& ce = (*i).second;
  293. CacheEntryType t = ce.m_Type;
  294. if(t == cmCacheManager::UNINITIALIZED)
  295. {
  296. /*
  297. // This should be added in, but is not for now.
  298. cmSystemTools::Error("Cache entry \"", (*i).first.c_str(),
  299. "\" is uninitialized");
  300. */
  301. }
  302. else if(t != INTERNAL)
  303. {
  304. // Format is key:type=value
  305. std::map<cmStdString,cmStdString>::const_iterator it =
  306. ce.m_Properties.find("HELPSTRING");
  307. if ( it == ce.m_Properties.end() )
  308. {
  309. cmCacheManager::OutputHelpString(fout, "Missing description");
  310. }
  311. else
  312. {
  313. cmCacheManager::OutputHelpString(fout, it->second);
  314. }
  315. std::string key;
  316. // support : in key name by double quoting
  317. if((*i).first.find(':') != std::string::npos ||
  318. (*i).first.find("//") == 0)
  319. {
  320. key = "\"";
  321. key += i->first;
  322. key += "\"";
  323. }
  324. else
  325. {
  326. key = i->first;
  327. }
  328. fout << key.c_str() << ":"
  329. << cmCacheManagerTypes[t] << "=";
  330. // if value has trailing space or tab, enclose it in single quotes
  331. if (ce.m_Value.size() &&
  332. (ce.m_Value[ce.m_Value.size() - 1] == ' ' ||
  333. ce.m_Value[ce.m_Value.size() - 1] == '\t'))
  334. {
  335. fout << '\'' << ce.m_Value << '\'';
  336. }
  337. else
  338. {
  339. fout << ce.m_Value;
  340. }
  341. fout << "\n\n";
  342. }
  343. }
  344. fout << "\n";
  345. fout << "########################\n";
  346. fout << "# INTERNAL cache entries\n";
  347. fout << "########################\n";
  348. fout << "\n";
  349. for( cmCacheManager::CacheIterator i = this->NewIterator();
  350. !i.IsAtEnd(); i.Next())
  351. {
  352. CacheEntryType t = i.GetType();
  353. bool advanced = i.GetPropertyAsBool("ADVANCED");
  354. if ( advanced )
  355. {
  356. // Format is key:type=value
  357. std::string key;
  358. std::string rkey = i.GetName();
  359. std::string helpstring;
  360. // If this is advanced variable, we have to do some magic for
  361. // backward compatibility
  362. helpstring = "Advanced flag for variable: ";
  363. helpstring += i.GetName();
  364. rkey += "-ADVANCED";
  365. cmCacheManager::OutputHelpString(fout, helpstring.c_str());
  366. // support : in key name by double quoting
  367. if(rkey.find(':') != std::string::npos ||
  368. rkey.find("//") == 0)
  369. {
  370. key = "\"";
  371. key += rkey;
  372. key += "\"";
  373. }
  374. else
  375. {
  376. key = rkey;
  377. }
  378. fout << key.c_str() << ":INTERNAL=1\n";
  379. }
  380. if(t == cmCacheManager::INTERNAL)
  381. {
  382. // Format is key:type=value
  383. std::string key;
  384. std::string rkey = i.GetName();
  385. std::string helpstring;
  386. helpstring = i.GetProperty("HELPSTRING");
  387. cmCacheManager::OutputHelpString(fout, helpstring.c_str());
  388. // support : in key name by double quoting
  389. if(rkey.find(':') != std::string::npos ||
  390. rkey.find("//") == 0)
  391. {
  392. key = "\"";
  393. key += rkey;
  394. key += "\"";
  395. }
  396. else
  397. {
  398. key = rkey;
  399. }
  400. fout << key.c_str() << ":"
  401. << cmCacheManagerTypes[t] << "=";
  402. // if value has trailing space or tab, enclose it in single quotes
  403. std::string value = i.GetValue();
  404. if (value.size() &&
  405. (value[value.size() - 1] == ' ' ||
  406. value[value.size() - 1] == '\t'))
  407. {
  408. fout << '\'' << value << '\'';
  409. }
  410. else
  411. {
  412. fout << value;
  413. }
  414. fout << "\n";
  415. }
  416. }
  417. fout << "\n";
  418. fout.close();
  419. cmSystemTools::CopyFileIfDifferent(tempFile.c_str(),
  420. cacheFile.c_str());
  421. cmSystemTools::RemoveFile(tempFile.c_str());
  422. return true;
  423. }
  424. void cmCacheManager::OutputHelpString(std::ofstream& fout,
  425. const std::string& helpString)
  426. {
  427. std::string::size_type end = helpString.size();
  428. if(end == 0)
  429. {
  430. return;
  431. }
  432. std::string oneLine;
  433. std::string::size_type pos = 0;
  434. std::string::size_type nextBreak = 60;
  435. bool done = false;
  436. while(!done)
  437. {
  438. if(nextBreak >= end)
  439. {
  440. nextBreak = end;
  441. done = true;
  442. }
  443. else
  444. {
  445. while(nextBreak < end && helpString[nextBreak] != ' ')
  446. {
  447. nextBreak++;
  448. }
  449. }
  450. oneLine = helpString.substr(pos, nextBreak - pos);
  451. fout << "//" << oneLine.c_str() << "\n";
  452. pos = nextBreak;
  453. nextBreak += 60;
  454. }
  455. }
  456. void cmCacheManager::RemoveCacheEntry(const char* key)
  457. {
  458. CacheEntryMap::iterator i = m_Cache.find(key);
  459. if(i != m_Cache.end())
  460. {
  461. m_Cache.erase(i);
  462. }
  463. else
  464. {
  465. std::cerr << "Failed to remove entry:" << key << std::endl;
  466. }
  467. }
  468. cmCacheManager::CacheEntry *cmCacheManager::GetCacheEntry(const char* key)
  469. {
  470. CacheEntryMap::iterator i = m_Cache.find(key);
  471. if(i != m_Cache.end())
  472. {
  473. return &i->second;
  474. }
  475. return 0;
  476. }
  477. cmCacheManager::CacheIterator cmCacheManager::GetCacheIterator(const char *key)
  478. {
  479. return CacheIterator(*this, key);
  480. }
  481. const char* cmCacheManager::GetCacheValue(const char* key) const
  482. {
  483. CacheEntryMap::const_iterator i = m_Cache.find(key);
  484. if(i != m_Cache.end())
  485. {
  486. return i->second.m_Value.c_str();
  487. }
  488. return 0;
  489. }
  490. void cmCacheManager::PrintCache(std::ostream& out) const
  491. {
  492. out << "=================================================" << std::endl;
  493. out << "CMakeCache Contents:" << std::endl;
  494. for(std::map<cmStdString, CacheEntry>::const_iterator i = m_Cache.begin();
  495. i != m_Cache.end(); ++i)
  496. {
  497. if((*i).second.m_Type != INTERNAL)
  498. {
  499. out << (*i).first.c_str() << " = " << (*i).second.m_Value.c_str() << std::endl;
  500. }
  501. }
  502. out << "\n\n";
  503. out << "To change values in the CMakeCache, \nedit CMakeCache.txt in your output directory.\n";
  504. out << "=================================================" << std::endl;
  505. }
  506. void cmCacheManager::AddCacheEntry(const char* key,
  507. const char* value,
  508. const char* helpString,
  509. CacheEntryType type)
  510. {
  511. CacheEntry& e = m_Cache[key];
  512. if ( value )
  513. {
  514. e.m_Value = value;
  515. }
  516. else
  517. {
  518. e.m_Value = "(none)";
  519. }
  520. e.m_Type = type;
  521. // make sure we only use unix style paths
  522. if(type == FILEPATH || type == PATH)
  523. {
  524. cmSystemTools::ConvertToUnixSlashes(e.m_Value);
  525. }
  526. if ( helpString )
  527. {
  528. e.m_Properties["HELPSTRING"] = helpString;
  529. }
  530. else
  531. {
  532. e.m_Properties["HELPSTRING"] = "(This variable does not exists and should not be used)";
  533. }
  534. m_Cache[key] = e;
  535. }
  536. void cmCacheManager::AddCacheEntry(const char* key, bool v,
  537. const char* helpString)
  538. {
  539. if(v)
  540. {
  541. this->AddCacheEntry(key, "ON", helpString, cmCacheManager::BOOL);
  542. }
  543. else
  544. {
  545. this->AddCacheEntry(key, "OFF", helpString, cmCacheManager::BOOL);
  546. }
  547. }
  548. bool cmCacheManager::CacheIterator::IsAtEnd()
  549. {
  550. return m_Position == m_Container.m_Cache.end();
  551. }
  552. void cmCacheManager::CacheIterator::Begin()
  553. {
  554. m_Position = m_Container.m_Cache.begin();
  555. }
  556. bool cmCacheManager::CacheIterator::Find(const char* key)
  557. {
  558. m_Position = m_Container.m_Cache.find(key);
  559. return !this->IsAtEnd();
  560. }
  561. void cmCacheManager::CacheIterator::Next()
  562. {
  563. ++m_Position;
  564. }
  565. void cmCacheManager::CacheIterator::SetValue(const char* value)
  566. {
  567. CacheEntry* entry = &this->GetEntry();
  568. entry->m_Value = value;
  569. }
  570. const char* cmCacheManager::CacheIterator::GetProperty(const char* property) const
  571. {
  572. if ( !strcmp(property, "TYPE") || !strcmp(property, "VALUE") )
  573. {
  574. cmSystemTools::Error("Property \"", property,
  575. "\" cannot be accessed through the GetProperty()");
  576. return 0;
  577. }
  578. const CacheEntry* ent = &this->GetEntry();
  579. std::map<cmStdString,cmStdString>::const_iterator it =
  580. ent->m_Properties.find(property);
  581. if ( it == ent->m_Properties.end() )
  582. {
  583. return 0;
  584. }
  585. return it->second.c_str();
  586. }
  587. void cmCacheManager::CacheIterator::SetProperty(const char* p, const char* v)
  588. {
  589. if ( !strcmp(p, "TYPE") || !strcmp(p, "VALUE") )
  590. {
  591. cmSystemTools::Error("Property \"", p,
  592. "\" cannot be accessed through the SetProperty()");
  593. return;
  594. }
  595. CacheEntry* ent = &this->GetEntry();
  596. ent->m_Properties[p] = v;
  597. }
  598. bool cmCacheManager::CacheIterator::GetPropertyAsBool(const char* property) const
  599. {
  600. if ( !strcmp(property, "TYPE") || !strcmp(property, "VALUE") )
  601. {
  602. cmSystemTools::Error("Property \"", property,
  603. "\" cannot be accessed through the GetPropertyAsBool()");
  604. return false;
  605. }
  606. const CacheEntry* ent = &this->GetEntry();
  607. std::map<cmStdString,cmStdString>::const_iterator it =
  608. ent->m_Properties.find(property);
  609. if ( it == ent->m_Properties.end() )
  610. {
  611. return false;
  612. }
  613. return cmSystemTools::IsOn(it->second.c_str());
  614. }
  615. void cmCacheManager::CacheIterator::SetProperty(const char* p, bool v)
  616. {
  617. if ( !strcmp(p, "TYPE") || !strcmp(p, "VALUE") )
  618. {
  619. cmSystemTools::Error("Property \"", p,
  620. "\" cannot be accessed through the SetProperty()");
  621. return;
  622. }
  623. CacheEntry* ent = &this->GetEntry();
  624. ent->m_Properties[p] = v ? "ON" : "OFF";
  625. }