summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2021-09-02 15:52:37 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2021-09-10 13:45:51 (GMT)
commit3c2e58eeb884adea8ee12462f7d471ab518a673f (patch)
treef8adf34b01f5364785d855a296f4f64686ef6cfb
parentc8991f17cf5bb07fc1b0d7fa68e9613fa8617900 (diff)
downloadCMake-3c2e58eeb884adea8ee12462f7d471ab518a673f.zip
CMake-3c2e58eeb884adea8ee12462f7d471ab518a673f.tar.gz
CMake-3c2e58eeb884adea8ee12462f7d471ab518a673f.tar.bz2
AddCacheEntry accept cmProp or std::string
-rw-r--r--Source/cmCacheManager.cxx6
-rw-r--r--Source/cmCacheManager.h16
-rw-r--r--Source/cmState.cxx2
-rw-r--r--Source/cmState.h12
-rw-r--r--Source/cmake.cxx2
-rw-r--r--Source/cmake.h12
6 files changed, 43 insertions, 7 deletions
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index 8fefaa6..0b59840 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -521,7 +521,7 @@ void cmCacheManager::PrintCache(std::ostream& out) const
"=================================================\n";
}
-void cmCacheManager::AddCacheEntry(const std::string& key, const char* value,
+void cmCacheManager::AddCacheEntry(const std::string& key, cmProp value,
const char* helpString,
cmStateEnums::CacheEntryType type)
{
@@ -550,10 +550,10 @@ void cmCacheManager::AddCacheEntry(const std::string& key, const char* value,
: "(This variable does not exist and should not be used)");
}
-void cmCacheManager::CacheEntry::SetValue(const char* value)
+void cmCacheManager::CacheEntry::SetValue(cmProp value)
{
if (value) {
- this->Value = value;
+ this->Value = *value;
this->Initialized = true;
} else {
this->Value.clear();
diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h
index 0238fb8..eca7150 100644
--- a/Source/cmCacheManager.h
+++ b/Source/cmCacheManager.h
@@ -31,7 +31,7 @@ class cmCacheManager
public:
const std::string& GetValue() const { return this->Value; }
- void SetValue(const char*);
+ void SetValue(cmProp);
cmStateEnums::CacheEntryType GetType() const { return this->Type; }
void SetType(cmStateEnums::CacheEntryType ty) { this->Type = ty; }
@@ -83,7 +83,7 @@ public:
void SetCacheEntryValue(std::string const& key, std::string const& value)
{
if (auto* entry = this->GetCacheEntry(key)) {
- entry->SetValue(value.c_str());
+ entry->SetValue(cmProp(value));
}
}
@@ -173,6 +173,18 @@ public:
//! Add an entry into the cache
void AddCacheEntry(const std::string& key, const char* value,
+ const char* helpString, cmStateEnums::CacheEntryType type)
+ {
+ this->AddCacheEntry(key,
+ value ? cmProp(std::string(value)) : cmProp(nullptr),
+ helpString, type);
+ }
+ void AddCacheEntry(const std::string& key, const std::string& value,
+ const char* helpString, cmStateEnums::CacheEntryType type)
+ {
+ this->AddCacheEntry(key, cmProp(value), helpString, type);
+ }
+ void AddCacheEntry(const std::string& key, cmProp value,
const char* helpString,
cmStateEnums::CacheEntryType type);
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index a045545..5a1ff27 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -206,7 +206,7 @@ bool cmState::GetCacheEntryPropertyAsBool(std::string const& key,
return this->CacheManager->GetCacheEntryPropertyAsBool(key, propertyName);
}
-void cmState::AddCacheEntry(const std::string& key, const char* value,
+void cmState::AddCacheEntry(const std::string& key, cmProp value,
const char* helpString,
cmStateEnums::CacheEntryType type)
{
diff --git a/Source/cmState.h b/Source/cmState.h
index 0fd28d0..390f6d6 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -219,6 +219,18 @@ public:
private:
friend class cmake;
void AddCacheEntry(const std::string& key, const char* value,
+ const char* helpString, cmStateEnums::CacheEntryType type)
+ {
+ this->AddCacheEntry(key,
+ value ? cmProp(std::string(value)) : cmProp(nullptr),
+ helpString, type);
+ }
+ void AddCacheEntry(const std::string& key, const std::string& value,
+ const char* helpString, cmStateEnums::CacheEntryType type)
+ {
+ this->AddCacheEntry(key, cmProp(value), helpString, type);
+ }
+ void AddCacheEntry(const std::string& key, cmProp value,
const char* helpString,
cmStateEnums::CacheEntryType type);
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index beb5d16..62ee380 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2416,7 +2416,7 @@ int cmake::Generate()
return 0;
}
-void cmake::AddCacheEntry(const std::string& key, const char* value,
+void cmake::AddCacheEntry(const std::string& key, cmProp value,
const char* helpString, int type)
{
this->State->AddCacheEntry(key, value, helpString,
diff --git a/Source/cmake.h b/Source/cmake.h
index 32c7582..7408044 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -332,6 +332,18 @@ public:
cmProp GetCacheDefinition(const std::string&) const;
//! Add an entry into the cache
void AddCacheEntry(const std::string& key, const char* value,
+ const char* helpString, int type)
+ {
+ this->AddCacheEntry(key,
+ value ? cmProp(std::string(value)) : cmProp(nullptr),
+ helpString, type);
+ }
+ void AddCacheEntry(const std::string& key, const std::string& value,
+ const char* helpString, int type)
+ {
+ this->AddCacheEntry(key, cmProp(value), helpString, type);
+ }
+ void AddCacheEntry(const std::string& key, cmProp value,
const char* helpString, int type);
bool DoWriteGlobVerifyTarget() const;