summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2023-05-28 14:27:03 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2023-05-30 14:41:59 (GMT)
commit4fc322bab421a83b12977aadc7dca247db8ae541 (patch)
tree3e57b548bd2326f3a848eb23ad66da33d28f60b5 /Source
parentb0d1ddb7234950374977b83f8dbded806c15b356 (diff)
downloadCMake-4fc322bab421a83b12977aadc7dca247db8ae541.zip
CMake-4fc322bab421a83b12977aadc7dca247db8ae541.tar.gz
CMake-4fc322bab421a83b12977aadc7dca247db8ae541.tar.bz2
AddCacheEntry: Suppress raw pointer usage
Diffstat (limited to 'Source')
-rw-r--r--Source/QtDialog/QCMake.cxx8
-rw-r--r--Source/cmCPluginAPI.cxx25
-rw-r--r--Source/cmCacheManager.cxx4
-rw-r--r--Source/cmCacheManager.h19
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx7
-rw-r--r--Source/cmFindBase.cxx8
-rw-r--r--Source/cmFindPackageCommand.cxx2
-rw-r--r--Source/cmGlobalGenerator.cxx8
-rw-r--r--Source/cmMakefile.cxx16
-rw-r--r--Source/cmMakefile.h17
-rw-r--r--Source/cmMarkAsAdvancedCommand.cxx3
-rw-r--r--Source/cmOptionCommand.cxx2
-rw-r--r--Source/cmSetCommand.cxx10
-rw-r--r--Source/cmState.cxx2
-rw-r--r--Source/cmState.h2
-rw-r--r--Source/cmTryRunCommand.cxx27
-rw-r--r--Source/cmake.cxx4
-rw-r--r--Source/cmake.h18
18 files changed, 97 insertions, 85 deletions
diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx
index 6ed24ca..f43f05f 100644
--- a/Source/QtDialog/QCMake.cxx
+++ b/Source/QtDialog/QCMake.cxx
@@ -359,19 +359,19 @@ void QCMake::setProperties(const QCMakePropertyList& newProps)
if (s.Type == QCMakeProperty::BOOL) {
this->CMakeInstance->AddCacheEntry(
s.Key.toStdString(), s.Value.toBool() ? "ON" : "OFF",
- s.Help.toStdString().c_str(), cmStateEnums::BOOL);
+ s.Help.toStdString(), cmStateEnums::BOOL);
} else if (s.Type == QCMakeProperty::STRING) {
this->CMakeInstance->AddCacheEntry(
s.Key.toStdString(), s.Value.toString().toStdString(),
- s.Help.toStdString().c_str(), cmStateEnums::STRING);
+ s.Help.toStdString(), cmStateEnums::STRING);
} else if (s.Type == QCMakeProperty::PATH) {
this->CMakeInstance->AddCacheEntry(
s.Key.toStdString(), s.Value.toString().toStdString(),
- s.Help.toStdString().c_str(), cmStateEnums::PATH);
+ s.Help.toStdString(), cmStateEnums::PATH);
} else if (s.Type == QCMakeProperty::FILEPATH) {
this->CMakeInstance->AddCacheEntry(
s.Key.toStdString(), s.Value.toString().toStdString(),
- s.Help.toStdString().c_str(), cmStateEnums::FILEPATH);
+ s.Help.toStdString(), cmStateEnums::FILEPATH);
}
}
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
index c2c5bdb..13ccf4f 100644
--- a/Source/cmCPluginAPI.cxx
+++ b/Source/cmCPluginAPI.cxx
@@ -14,6 +14,7 @@
#include "cmMakefile.h"
#include "cmSourceFile.h"
#include "cmState.h"
+#include "cmValue.h"
#include "cmVersion.h"
#ifdef __QNX__
@@ -78,25 +79,37 @@ static void CCONV cmAddCacheDefinition(void* arg, const char* name,
int type)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
+ std::string valueString;
+ std::string docString;
+ cmValue v;
+ cmValue d;
+ if (value != nullptr) {
+ valueString = value;
+ v = cmValue{ valueString };
+ }
+ if (doc != nullptr) {
+ docString = doc;
+ d = cmValue{ docString };
+ }
switch (type) {
case CM_CACHE_BOOL:
- mf->AddCacheDefinition(name, value, doc, cmStateEnums::BOOL);
+ mf->AddCacheDefinition(name, v, d, cmStateEnums::BOOL);
break;
case CM_CACHE_PATH:
- mf->AddCacheDefinition(name, value, doc, cmStateEnums::PATH);
+ mf->AddCacheDefinition(name, v, d, cmStateEnums::PATH);
break;
case CM_CACHE_FILEPATH:
- mf->AddCacheDefinition(name, value, doc, cmStateEnums::FILEPATH);
+ mf->AddCacheDefinition(name, v, d, cmStateEnums::FILEPATH);
break;
case CM_CACHE_STRING:
- mf->AddCacheDefinition(name, value, doc, cmStateEnums::STRING);
+ mf->AddCacheDefinition(name, v, d, cmStateEnums::STRING);
break;
case CM_CACHE_INTERNAL:
- mf->AddCacheDefinition(name, value, doc, cmStateEnums::INTERNAL);
+ mf->AddCacheDefinition(name, v, d, cmStateEnums::INTERNAL);
break;
case CM_CACHE_STATIC:
- mf->AddCacheDefinition(name, value, doc, cmStateEnums::STATIC);
+ mf->AddCacheDefinition(name, v, d, cmStateEnums::STATIC);
break;
}
}
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index 8633de1..0c6b225 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -523,7 +523,7 @@ void cmCacheManager::PrintCache(std::ostream& out) const
}
void cmCacheManager::AddCacheEntry(const std::string& key, cmValue value,
- const char* helpString,
+ cmValue helpString,
cmStateEnums::CacheEntryType type)
{
CacheEntry& e = this->Cache[key];
@@ -543,7 +543,7 @@ void cmCacheManager::AddCacheEntry(const std::string& key, cmValue value,
}
e.SetProperty(
"HELPSTRING",
- helpString ? std::string{ helpString }
+ helpString ? *helpString
: std::string{
"(This variable does not exist and should not be used)" });
}
diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h
index a2da0b5..5268248 100644
--- a/Source/cmCacheManager.h
+++ b/Source/cmCacheManager.h
@@ -173,20 +173,19 @@ public:
unsigned int GetCacheMinorVersion() const { return this->CacheMinorVersion; }
//! 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 ? cmValue(std::string(value)) : cmValue(nullptr),
- helpString, type);
- }
void AddCacheEntry(const std::string& key, const std::string& value,
- const char* helpString, cmStateEnums::CacheEntryType type)
+ const std::string& helpString,
+ cmStateEnums::CacheEntryType type)
{
- this->AddCacheEntry(key, cmValue(value), helpString, type);
+ this->AddCacheEntry(key, cmValue{ value }, cmValue{ helpString }, type);
}
void AddCacheEntry(const std::string& key, cmValue value,
- const char* helpString,
+ const std::string& helpString,
+ cmStateEnums::CacheEntryType type)
+ {
+ this->AddCacheEntry(key, value, cmValue{ helpString }, type);
+ }
+ void AddCacheEntry(const std::string& key, cmValue value, cmValue helpString,
cmStateEnums::CacheEntryType type);
//! Remove an entry from the cache
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index c7ce5b0..6cba37b 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -257,7 +257,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(std::ostream& out,
// The variable is in the env, but not in the cache. Use it and put it
// in the cache
valueToUse = envVarValue;
- mf->AddCacheDefinition(cacheEntryName, valueToUse, cacheEntryName.c_str(),
+ mf->AddCacheDefinition(cacheEntryName, valueToUse, cacheEntryName,
cmStateEnums::STRING, true);
mf->GetCMakeInstance()->SaveCache(lg.GetBinaryDirectory());
} else if (!envVarSet && cacheValue) {
@@ -272,9 +272,8 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(std::ostream& out,
valueToUse = *cacheValue;
if (valueToUse.find(envVarValue) == std::string::npos) {
valueToUse = envVarValue;
- mf->AddCacheDefinition(cacheEntryName, valueToUse,
- cacheEntryName.c_str(), cmStateEnums::STRING,
- true);
+ mf->AddCacheDefinition(cacheEntryName, valueToUse, cacheEntryName,
+ cmStateEnums::STRING, true);
mf->GetCMakeInstance()->SaveCache(lg.GetBinaryDirectory());
}
}
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index 929c6c1..5e92dd0 100644
--- a/Source/cmFindBase.cxx
+++ b/Source/cmFindBase.cxx
@@ -509,7 +509,7 @@ void cmFindBase::NormalizeFindResult()
// value.
if (value != *existingValue || this->AlreadyInCacheWithoutMetaInfo) {
this->Makefile->GetCMakeInstance()->AddCacheEntry(
- this->VariableName, value, this->VariableDocumentation.c_str(),
+ this->VariableName, value, this->VariableDocumentation,
this->VariableType);
if (this->Makefile->GetPolicyStatus(cmPolicies::CMP0126) ==
cmPolicies::NEW) {
@@ -534,7 +534,7 @@ void cmFindBase::NormalizeFindResult()
if (this->StoreResultInCache) {
if (this->AlreadyInCacheWithoutMetaInfo) {
this->Makefile->AddCacheDefinition(this->VariableName, "",
- this->VariableDocumentation.c_str(),
+ this->VariableDocumentation,
this->VariableType);
if (this->Makefile->GetPolicyStatus(cmPolicies::CMP0126) ==
cmPolicies::NEW &&
@@ -564,7 +564,7 @@ void cmFindBase::StoreFindResult(const std::string& value)
if (!value.empty()) {
if (this->StoreResultInCache) {
this->Makefile->AddCacheDefinition(this->VariableName, value,
- this->VariableDocumentation.c_str(),
+ this->VariableDocumentation,
this->VariableType, force);
if (updateNormalVariable &&
this->Makefile->IsNormalDefinitionSet(this->VariableName)) {
@@ -580,7 +580,7 @@ void cmFindBase::StoreFindResult(const std::string& value)
auto notFound = cmStrCat(this->VariableName, "-NOTFOUND");
if (this->StoreResultInCache) {
this->Makefile->AddCacheDefinition(this->VariableName, notFound,
- this->VariableDocumentation.c_str(),
+ this->VariableDocumentation,
this->VariableType, force);
if (updateNormalVariable &&
this->Makefile->IsNormalDefinitionSet(this->VariableName)) {
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 1c2a937..f863a51 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -1728,7 +1728,7 @@ void cmFindPackageCommand::SetConfigDirCacheVariable(const std::string& value)
std::string const help =
cmStrCat("The directory containing a CMake configuration file for ",
this->Name, '.');
- this->Makefile->AddCacheDefinition(this->Variable, value, help.c_str(),
+ this->Makefile->AddCacheDefinition(this->Variable, value, help,
cmStateEnums::PATH, true);
if (this->Makefile->GetPolicyStatus(cmPolicies::CMP0126) ==
cmPolicies::NEW &&
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 22d5aeb..68c74dd 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1357,11 +1357,9 @@ void cmGlobalGenerator::Configure()
// update the cache entry for the number of local generators, this is used
// for progress
- char num[100];
- snprintf(num, sizeof(num), "%d", static_cast<int>(this->Makefiles.size()));
- this->GetCMakeInstance()->AddCacheEntry("CMAKE_NUMBER_OF_MAKEFILES", num,
- "number of local generators",
- cmStateEnums::INTERNAL);
+ this->GetCMakeInstance()->AddCacheEntry(
+ "CMAKE_NUMBER_OF_MAKEFILES", std::to_string(this->Makefiles.size()),
+ "number of local generators", cmStateEnums::INTERNAL);
auto endTime = std::chrono::steady_clock::now();
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 585924d..4acb283 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1939,8 +1939,8 @@ void cmMakefile::AddDefinitionBool(const std::string& name, bool value)
this->AddDefinition(name, value ? "ON" : "OFF");
}
-void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
- const char* doc,
+void cmMakefile::AddCacheDefinition(const std::string& name, cmValue value,
+ cmValue doc,
cmStateEnums::CacheEntryType type,
bool force)
{
@@ -1954,22 +1954,20 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
// if this is not a force, then use the value from the cache
// if it is a force, then use the value being passed in
if (!force) {
- value = existingValue->c_str();
+ value = existingValue;
}
if (type == cmStateEnums::PATH || type == cmStateEnums::FILEPATH) {
- nvalue = value ? value : "";
-
- cmList files(nvalue);
+ cmList files(value);
for (auto& file : files) {
if (!cmIsOff(file)) {
file = cmSystemTools::CollapseFullPath(file);
}
}
nvalue = files.to_string();
+ value = cmValue{ nvalue };
- this->GetCMakeInstance()->AddCacheEntry(name, nvalue, doc, type);
- nvalue = *this->GetState()->GetInitializedCacheValue(name);
- value = nvalue.c_str();
+ this->GetCMakeInstance()->AddCacheEntry(name, value, doc, type);
+ value = this->GetState()->GetInitializedCacheValue(name);
}
}
this->GetCMakeInstance()->AddCacheEntry(name, value, doc, type);
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 6fdadab..7005942 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -302,14 +302,23 @@ public:
*/
void AddDefinitionBool(const std::string& name, bool);
//! Add a definition to this makefile and the global cmake cache.
- void AddCacheDefinition(const std::string& name, const char* value,
- const char* doc, cmStateEnums::CacheEntryType type,
+ void AddCacheDefinition(const std::string& name, cmValue value, cmValue doc,
+ cmStateEnums::CacheEntryType type,
bool force = false);
+ void AddCacheDefinition(const std::string& name, cmValue value,
+ const std::string& doc,
+ cmStateEnums::CacheEntryType type,
+ bool force = false)
+ {
+ this->AddCacheDefinition(name, value, cmValue{ doc }, type, force);
+ }
void AddCacheDefinition(const std::string& name, const std::string& value,
- const char* doc, cmStateEnums::CacheEntryType type,
+ const std::string& doc,
+ cmStateEnums::CacheEntryType type,
bool force = false)
{
- this->AddCacheDefinition(name, value.c_str(), doc, type, force);
+ this->AddCacheDefinition(name, cmValue{ value }, cmValue{ doc }, type,
+ force);
}
/**
diff --git a/Source/cmMarkAsAdvancedCommand.cxx b/Source/cmMarkAsAdvancedCommand.cxx
index 73e5f33..87421f5 100644
--- a/Source/cmMarkAsAdvancedCommand.cxx
+++ b/Source/cmMarkAsAdvancedCommand.cxx
@@ -83,7 +83,8 @@ bool cmMarkAsAdvancedCommand(std::vector<std::string> const& args,
if (oldBehavior) {
if (!state->GetCacheEntryValue(variable)) {
status.GetMakefile().GetCMakeInstance()->AddCacheEntry(
- variable, nullptr, nullptr, cmStateEnums::UNINITIALIZED);
+ variable, cmValue{ nullptr }, cmValue{ nullptr },
+ cmStateEnums::UNINITIALIZED);
overwrite = true;
}
}
diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx
index ec54fc5..d589f0e 100644
--- a/Source/cmOptionCommand.cxx
+++ b/Source/cmOptionCommand.cxx
@@ -67,7 +67,7 @@ bool cmOptionCommand(std::vector<std::string> const& args,
}
bool init = cmIsOn(initialValue);
status.GetMakefile().AddCacheDefinition(args[0], init ? "ON" : "OFF",
- args[1].c_str(), cmStateEnums::BOOL);
+ args[1], cmStateEnums::BOOL);
if (status.GetMakefile().GetPolicyStatus(cmPolicies::CMP0077) !=
cmPolicies::NEW &&
status.GetMakefile().GetPolicyStatus(cmPolicies::CMP0126) ==
diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx
index ce0cb25..040eb08 100644
--- a/Source/cmSetCommand.cxx
+++ b/Source/cmSetCommand.cxx
@@ -79,8 +79,8 @@ bool cmSetCommand(std::vector<std::string> const& args,
bool force = false; // optional
bool parentScope = false;
cmStateEnums::CacheEntryType type =
- cmStateEnums::STRING; // required if cache
- const char* docstring = nullptr; // required if cache
+ cmStateEnums::STRING; // required if cache
+ cmValue docstring; // required if cache
unsigned int ignoreLastArgs = 0;
// look for PARENT_SCOPE argument
@@ -131,7 +131,7 @@ bool cmSetCommand(std::vector<std::string> const& args,
// ensure that the type is actually converting to a string.
type = cmStateEnums::STRING;
}
- docstring = args[cacheStart + 2].c_str();
+ docstring = cmValue{ args[cacheStart + 2] };
}
// see if this is already in the cache
@@ -150,8 +150,8 @@ bool cmSetCommand(std::vector<std::string> const& args,
// if it is meant to be in the cache then define it in the cache
if (cache) {
- status.GetMakefile().AddCacheDefinition(variable, value, docstring, type,
- force);
+ status.GetMakefile().AddCacheDefinition(variable, cmValue{ value },
+ docstring, type, force);
} else {
// add the definition
status.GetMakefile().AddDefinition(variable, value);
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index a72f830..2596d8c 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -209,7 +209,7 @@ bool cmState::GetCacheEntryPropertyAsBool(std::string const& key,
}
void cmState::AddCacheEntry(const std::string& key, cmValue value,
- const char* helpString,
+ const std::string& helpString,
cmStateEnums::CacheEntryType type)
{
this->CacheManager->AddCacheEntry(key, value, helpString, type);
diff --git a/Source/cmState.h b/Source/cmState.h
index d9d2c21..1ebd79a 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -254,7 +254,7 @@ public:
private:
friend class cmake;
void AddCacheEntry(const std::string& key, cmValue value,
- const char* helpString,
+ const std::string& helpString,
cmStateEnums::CacheEntryType type);
bool DoWriteGlobVerifyTarget() const;
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index 368155c..c24c418 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -2,7 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmTryRunCommand.h"
-#include <cstdio>
#include <stdexcept>
#include <cm/optional>
@@ -293,11 +292,9 @@ void TryRunCommandImpl::RunExecutable(const std::string& runArgs,
workDir ? workDir->c_str() : nullptr, cmSystemTools::OUTPUT_NONE,
cmDuration::zero());
// set the run var
- char retChar[16];
- const char* retStr;
+ std::string retStr;
if (worked) {
- snprintf(retChar, sizeof(retChar), "%i", retVal);
- retStr = retChar;
+ retStr = std::to_string(retVal);
} else {
retStr = "FAILED_TO_RUN";
}
@@ -351,7 +348,7 @@ void TryRunCommandImpl::DoNotRunExecutable(
detailsString);
this->Makefile->AddCacheDefinition(this->RunResultVariable,
"PLEASE_FILL_OUT-FAILED_TO_RUN",
- comment.c_str(), cmStateEnums::STRING);
+ comment, cmStateEnums::STRING);
cmState* state = this->Makefile->GetState();
cmValue existingValue = state->GetCacheEntryValue(this->RunResultVariable);
@@ -372,9 +369,9 @@ void TryRunCommandImpl::DoNotRunExecutable(
"would have printed on stdout on its target platform.\n",
detailsString);
- this->Makefile->AddCacheDefinition(
- internalRunOutputStdOutName, "PLEASE_FILL_OUT-NOTFOUND",
- comment.c_str(), cmStateEnums::STRING);
+ this->Makefile->AddCacheDefinition(internalRunOutputStdOutName,
+ "PLEASE_FILL_OUT-NOTFOUND", comment,
+ cmStateEnums::STRING);
cmState* state = this->Makefile->GetState();
cmValue existing =
state->GetCacheEntryValue(internalRunOutputStdOutName);
@@ -394,9 +391,9 @@ void TryRunCommandImpl::DoNotRunExecutable(
"would have printed on stderr on its target platform.\n",
detailsString);
- this->Makefile->AddCacheDefinition(
- internalRunOutputStdErrName, "PLEASE_FILL_OUT-NOTFOUND",
- comment.c_str(), cmStateEnums::STRING);
+ this->Makefile->AddCacheDefinition(internalRunOutputStdErrName,
+ "PLEASE_FILL_OUT-NOTFOUND", comment,
+ cmStateEnums::STRING);
cmState* state = this->Makefile->GetState();
cmValue existing =
state->GetCacheEntryValue(internalRunOutputStdErrName);
@@ -416,9 +413,9 @@ void TryRunCommandImpl::DoNotRunExecutable(
"would have printed on stdout and stderr on its target platform.\n",
detailsString);
- this->Makefile->AddCacheDefinition(
- internalRunOutputName, "PLEASE_FILL_OUT-NOTFOUND", comment.c_str(),
- cmStateEnums::STRING);
+ this->Makefile->AddCacheDefinition(internalRunOutputName,
+ "PLEASE_FILL_OUT-NOTFOUND", comment,
+ cmStateEnums::STRING);
cmState* state = this->Makefile->GetState();
cmValue existing = state->GetCacheEntryValue(internalRunOutputName);
if (existing) {
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index c5b467d..3694ea8 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2205,7 +2205,7 @@ int cmake::HandleDeleteCacheVariables(const std::string& var)
this->LoadCache();
// restore the changed compilers
for (SaveCacheEntry const& i : saved) {
- this->AddCacheEntry(i.key, i.value, i.help.c_str(), i.type);
+ this->AddCacheEntry(i.key, i.value, i.help, i.type);
}
cmSystemTools::Message(warning.str());
// avoid reconfigure if there were errors
@@ -2775,7 +2775,7 @@ int cmake::Generate()
}
void cmake::AddCacheEntry(const std::string& key, cmValue value,
- const char* helpString, int type)
+ cmValue helpString, int type)
{
this->State->AddCacheEntry(key, value, helpString,
static_cast<cmStateEnums::CacheEntryType>(type));
diff --git a/Source/cmake.h b/Source/cmake.h
index 955ec4f..9da0295 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -328,20 +328,18 @@ public:
*/
cmValue 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 ? cmValue(std::string(value)) : cmValue(nullptr),
- helpString, type);
- }
void AddCacheEntry(const std::string& key, const std::string& value,
- const char* helpString, int type)
+ const std::string& helpString, int type)
{
- this->AddCacheEntry(key, cmValue(value), helpString, type);
+ this->AddCacheEntry(key, cmValue{ value }, cmValue{ helpString }, type);
}
void AddCacheEntry(const std::string& key, cmValue value,
- const char* helpString, int type);
+ const std::string& helpString, int type)
+ {
+ this->AddCacheEntry(key, value, cmValue{ helpString }, type);
+ }
+ void AddCacheEntry(const std::string& key, cmValue value, cmValue helpString,
+ int type);
bool DoWriteGlobVerifyTarget() const;
std::string const& GetGlobVerifyScript() const;