|
@@ -84,7 +84,7 @@ bool cmCacheManager::LoadCache(const std::string& path, bool internal,
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- e.SetProperty("HELPSTRING", helpString.c_str());
|
|
|
|
|
|
|
+ e.SetProperty("HELPSTRING", helpString);
|
|
|
if (cmState::ParseCacheEntry(realbuffer, entryKey, e.Value, e.Type)) {
|
|
if (cmState::ParseCacheEntry(realbuffer, entryKey, e.Value, e.Type)) {
|
|
|
if (excludes.find(entryKey) == excludes.end()) {
|
|
if (excludes.find(entryKey) == excludes.end()) {
|
|
|
// Load internal values if internal is set.
|
|
// Load internal values if internal is set.
|
|
@@ -102,7 +102,7 @@ bool cmCacheManager::LoadCache(const std::string& path, bool internal,
|
|
|
" loaded from external file. "
|
|
" loaded from external file. "
|
|
|
"To change this value edit this file: ",
|
|
"To change this value edit this file: ",
|
|
|
path, "/CMakeCache.txt");
|
|
path, "/CMakeCache.txt");
|
|
|
- e.SetProperty("HELPSTRING", helpString.c_str());
|
|
|
|
|
|
|
+ e.SetProperty("HELPSTRING", helpString);
|
|
|
}
|
|
}
|
|
|
if (!this->ReadPropertyEntry(entryKey, e)) {
|
|
if (!this->ReadPropertyEntry(entryKey, e)) {
|
|
|
e.Initialized = true;
|
|
e.Initialized = true;
|
|
@@ -186,11 +186,11 @@ bool cmCacheManager::ReadPropertyEntry(const std::string& entryKey,
|
|
|
std::string key = entryKey.substr(0, entryKey.size() - plen);
|
|
std::string key = entryKey.substr(0, entryKey.size() - plen);
|
|
|
if (auto* entry = this->GetCacheEntry(key)) {
|
|
if (auto* entry = this->GetCacheEntry(key)) {
|
|
|
// Store this property on its entry.
|
|
// Store this property on its entry.
|
|
|
- entry->SetProperty(p, e.Value.c_str());
|
|
|
|
|
|
|
+ entry->SetProperty(p, e.Value);
|
|
|
} else {
|
|
} else {
|
|
|
// Create an entry and store the property.
|
|
// Create an entry and store the property.
|
|
|
CacheEntry& ne = this->Cache[key];
|
|
CacheEntry& ne = this->Cache[key];
|
|
|
- ne.SetProperty(p, e.Value.c_str());
|
|
|
|
|
|
|
+ ne.SetProperty(p, e.Value);
|
|
|
}
|
|
}
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
@@ -541,10 +541,11 @@ void cmCacheManager::AddCacheEntry(const std::string& key, cmValue value,
|
|
|
cmSystemTools::ConvertToUnixSlashes(e.Value);
|
|
cmSystemTools::ConvertToUnixSlashes(e.Value);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- e.SetProperty("HELPSTRING",
|
|
|
|
|
- helpString
|
|
|
|
|
- ? helpString
|
|
|
|
|
- : "(This variable does not exist and should not be used)");
|
|
|
|
|
|
|
+ e.SetProperty(
|
|
|
|
|
+ "HELPSTRING",
|
|
|
|
|
+ helpString ? std::string{ helpString }
|
|
|
|
|
+ : std::string{
|
|
|
|
|
+ "(This variable does not exist and should not be used)" });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void cmCacheManager::CacheEntry::SetValue(cmValue value)
|
|
void cmCacheManager::CacheEntry::SetValue(cmValue value)
|
|
@@ -580,12 +581,12 @@ bool cmCacheManager::CacheEntry::GetPropertyAsBool(
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void cmCacheManager::CacheEntry::SetProperty(const std::string& prop,
|
|
void cmCacheManager::CacheEntry::SetProperty(const std::string& prop,
|
|
|
- const char* value)
|
|
|
|
|
|
|
+ const std::string& value)
|
|
|
{
|
|
{
|
|
|
if (prop == "TYPE") {
|
|
if (prop == "TYPE") {
|
|
|
- this->Type = cmState::StringToCacheEntryType(value ? value : "STRING");
|
|
|
|
|
|
|
+ this->Type = cmState::StringToCacheEntryType(value);
|
|
|
} else if (prop == "VALUE") {
|
|
} else if (prop == "VALUE") {
|
|
|
- this->Value = value ? value : "";
|
|
|
|
|
|
|
+ this->Value = value;
|
|
|
} else {
|
|
} else {
|
|
|
this->Properties.SetProperty(prop, value);
|
|
this->Properties.SetProperty(prop, value);
|
|
|
}
|
|
}
|
|
@@ -593,7 +594,19 @@ void cmCacheManager::CacheEntry::SetProperty(const std::string& prop,
|
|
|
|
|
|
|
|
void cmCacheManager::CacheEntry::SetProperty(const std::string& p, bool v)
|
|
void cmCacheManager::CacheEntry::SetProperty(const std::string& p, bool v)
|
|
|
{
|
|
{
|
|
|
- this->SetProperty(p, v ? "ON" : "OFF");
|
|
|
|
|
|
|
+ this->SetProperty(p, v ? std::string{ "ON" } : std::string{ "OFF" });
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+void cmCacheManager::CacheEntry::SetProperty(const std::string& prop,
|
|
|
|
|
+ std::nullptr_t)
|
|
|
|
|
+{
|
|
|
|
|
+ if (prop == "TYPE") {
|
|
|
|
|
+ this->Type = cmState::StringToCacheEntryType("STRING");
|
|
|
|
|
+ } else if (prop == "VALUE") {
|
|
|
|
|
+ this->Value = "";
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this->Properties.SetProperty(prop, cmValue{ nullptr });
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void cmCacheManager::CacheEntry::AppendProperty(const std::string& prop,
|
|
void cmCacheManager::CacheEntry::AppendProperty(const std::string& prop,
|