summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorVitaly Stakhovsky <vvs31415@gitlab.org>2020-01-25 10:37:00 -0500
committerVitaly Stakhovsky <vvs31415@gitlab.org>2020-01-25 10:37:00 -0500
commit1398517f315b2b0420972df1dc1e61294ea5f749 (patch)
tree91d5278f549d2f49a441e127215c8ca0896586b6 /Source
parent33e7bd66c09ee51edbbccfc1014813e30d80ec5f (diff)
downloadcmake-1398517f315b2b0420972df1dc1e61294ea5f749.tar.gz
AppendProperty: convert value param to std::string
Diffstat (limited to 'Source')
-rw-r--r--Source/cmCacheManager.cxx6
-rw-r--r--Source/cmGlobalGenerator.cxx4
-rw-r--r--Source/cmLinkLibrariesCommand.cxx2
-rw-r--r--Source/cmMacroCommand.cxx2
-rw-r--r--Source/cmMakefile.cxx10
-rw-r--r--Source/cmMakefile.h2
-rw-r--r--Source/cmPropertyMap.cxx6
-rw-r--r--Source/cmPropertyMap.h2
-rw-r--r--Source/cmSetPropertyCommand.cxx117
-rw-r--r--Source/cmSourceFile.cxx10
-rw-r--r--Source/cmSourceFile.h2
-rw-r--r--Source/cmState.cxx4
-rw-r--r--Source/cmState.h2
-rw-r--r--Source/cmStateDirectory.cxx2
-rw-r--r--Source/cmStateDirectory.h2
-rw-r--r--Source/cmTarget.cxx20
-rw-r--r--Source/cmTarget.h7
-rw-r--r--Source/cmTest.cxx2
-rw-r--r--Source/cmTest.h2
-rw-r--r--Source/cmake.cxx2
-rw-r--r--Source/cmake.h2
21 files changed, 98 insertions, 110 deletions
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index 265941abb3..dc9aba187f 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -648,8 +648,8 @@ void cmCacheManager::CacheEntry::AppendProperty(const std::string& prop,
bool asString)
{
if (prop == "TYPE") {
- this->Type = cmState::StringToCacheEntryType(!value.empty() ? value.c_str()
- : "STRING");
+ this->Type =
+ cmState::StringToCacheEntryType(!value.empty() ? value : "STRING");
} else if (prop == "VALUE") {
if (!value.empty()) {
if (!this->Value.empty() && !asString) {
@@ -658,7 +658,7 @@ void cmCacheManager::CacheEntry::AppendProperty(const std::string& prop,
this->Value += value;
}
} else {
- this->Properties.AppendProperty(prop, value.c_str(), asString);
+ this->Properties.AppendProperty(prop, value, asString);
}
}
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 38ff3aebea..45e13bcc4b 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1645,7 +1645,9 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo()
for (std::string const& c : configs) {
std::string defPropName =
cmStrCat("COMPILE_DEFINITIONS_", cmSystemTools::UpperCase(c));
- t->AppendProperty(defPropName, mf->GetProperty(defPropName));
+ if (const char* val = mf->GetProperty(defPropName)) {
+ t->AppendProperty(defPropName, val);
+ }
}
}
}
diff --git a/Source/cmLinkLibrariesCommand.cxx b/Source/cmLinkLibrariesCommand.cxx
index cb63ceb03a..2b8f836227 100644
--- a/Source/cmLinkLibrariesCommand.cxx
+++ b/Source/cmLinkLibrariesCommand.cxx
@@ -32,7 +32,7 @@ bool cmLinkLibrariesCommand(std::vector<std::string> const& args,
}
mf.AppendProperty("LINK_LIBRARIES", "optimized");
}
- mf.AppendProperty("LINK_LIBRARIES", i->c_str());
+ mf.AppendProperty("LINK_LIBRARIES", *i);
}
return true;
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index a35dc20428..0b0d9ac318 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -167,7 +167,7 @@ bool cmMacroFunctionBlocker::Replay(std::vector<cmListFileFunction> functions,
cmExecutionStatus& status)
{
cmMakefile& mf = status.GetMakefile();
- mf.AppendProperty("MACROS", this->Args[0].c_str());
+ mf.AppendProperty("MACROS", this->Args[0]);
// create a new command and add it to cmake
cmMacroHelperCommand f;
f.Args = this->Args;
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 59995be53e..e43ee8af48 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1288,17 +1288,17 @@ void cmMakefile::RemoveDefineFlag(std::string const& flag)
void cmMakefile::AddCompileDefinition(std::string const& option)
{
- this->AppendProperty("COMPILE_DEFINITIONS", option.c_str());
+ this->AppendProperty("COMPILE_DEFINITIONS", option);
}
void cmMakefile::AddCompileOption(std::string const& option)
{
- this->AppendProperty("COMPILE_OPTIONS", option.c_str());
+ this->AppendProperty("COMPILE_OPTIONS", option);
}
void cmMakefile::AddLinkOption(std::string const& option)
{
- this->AppendProperty("LINK_OPTIONS", option.c_str());
+ this->AppendProperty("LINK_OPTIONS", option);
}
void cmMakefile::AddLinkDirectory(std::string const& directory, bool before)
@@ -4039,8 +4039,8 @@ void cmMakefile::SetProperty(const std::string& prop, const char* value)
this->StateSnapshot.GetDirectory().SetProperty(prop, value, this->Backtrace);
}
-void cmMakefile::AppendProperty(const std::string& prop, const char* value,
- bool asString)
+void cmMakefile::AppendProperty(const std::string& prop,
+ const std::string& value, bool asString)
{
this->StateSnapshot.GetDirectory().AppendProperty(prop, value, asString,
this->Backtrace);
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index b13716bcda..9e9c2b8f90 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -784,7 +784,7 @@ public:
//! Set/Get a property of this directory
void SetProperty(const std::string& prop, const char* value);
- void AppendProperty(const std::string& prop, const char* value,
+ void AppendProperty(const std::string& prop, const std::string& value,
bool asString = false);
const char* GetProperty(const std::string& prop) const;
const char* GetProperty(const std::string& prop, bool chain) const;
diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx
index a3d49460b3..d4b35523fe 100644
--- a/Source/cmPropertyMap.cxx
+++ b/Source/cmPropertyMap.cxx
@@ -20,11 +20,11 @@ void cmPropertyMap::SetProperty(const std::string& name, const char* value)
Map_[name] = value;
}
-void cmPropertyMap::AppendProperty(const std::string& name, const char* value,
- bool asString)
+void cmPropertyMap::AppendProperty(const std::string& name,
+ const std::string& value, bool asString)
{
// Skip if nothing to append.
- if (!value || !*value) {
+ if (value.empty()) {
return;
}
diff --git a/Source/cmPropertyMap.h b/Source/cmPropertyMap.h
index 9aed34960e..bea4372843 100644
--- a/Source/cmPropertyMap.h
+++ b/Source/cmPropertyMap.h
@@ -27,7 +27,7 @@ public:
void SetProperty(const std::string& name, const char* value);
//! Append to the property value
- void AppendProperty(const std::string& name, const char* value,
+ void AppendProperty(const std::string& name, const std::string& value,
bool asString = false);
//! Get the property value
diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx
index 112d832e63..3705727d87 100644
--- a/Source/cmSetPropertyCommand.cxx
+++ b/Source/cmSetPropertyCommand.cxx
@@ -194,9 +194,8 @@ namespace {
bool HandleGlobalMode(cmExecutionStatus& status,
const std::set<std::string>& names,
const std::string& propertyName,
- const std::string& propertyValue,
- const bool appendAsString, const bool appendMode,
- const bool remove)
+ const std::string& propertyValue, bool appendAsString,
+ bool appendMode, bool remove)
{
if (!names.empty()) {
status.SetError("given names for GLOBAL scope.");
@@ -205,14 +204,14 @@ bool HandleGlobalMode(cmExecutionStatus& status,
// Set or append the property.
cmake* cm = status.GetMakefile().GetCMakeInstance();
- const char* value = propertyValue.c_str();
- if (remove) {
- value = nullptr;
- }
if (appendMode) {
- cm->AppendProperty(propertyName, value ? value : "", appendAsString);
+ cm->AppendProperty(propertyName, propertyValue, appendAsString);
} else {
- cm->SetProperty(propertyName, value);
+ if (remove) {
+ cm->SetProperty(propertyName, nullptr);
+ } else {
+ cm->SetProperty(propertyName, propertyValue.c_str());
+ }
}
return true;
@@ -221,9 +220,8 @@ bool HandleGlobalMode(cmExecutionStatus& status,
bool HandleDirectoryMode(cmExecutionStatus& status,
const std::set<std::string>& names,
const std::string& propertyName,
- const std::string& propertyValue,
- const bool appendAsString, const bool appendMode,
- const bool remove)
+ const std::string& propertyValue, bool appendAsString,
+ bool appendMode, bool remove)
{
if (names.size() > 1) {
status.SetError("allows at most one name for DIRECTORY scope.");
@@ -258,14 +256,14 @@ bool HandleDirectoryMode(cmExecutionStatus& status,
}
// Set or append the property.
- const char* value = propertyValue.c_str();
- if (remove) {
- value = nullptr;
- }
if (appendMode) {
- mf->AppendProperty(propertyName, value ? value : "", appendAsString);
+ mf->AppendProperty(propertyName, propertyValue, appendAsString);
} else {
- mf->SetProperty(propertyName, value);
+ if (remove) {
+ mf->SetProperty(propertyName, nullptr);
+ } else {
+ mf->SetProperty(propertyName, propertyValue.c_str());
+ }
}
return true;
@@ -274,9 +272,8 @@ bool HandleDirectoryMode(cmExecutionStatus& status,
bool HandleTargetMode(cmExecutionStatus& status,
const std::set<std::string>& names,
const std::string& propertyName,
- const std::string& propertyValue,
- const bool appendAsString, const bool appendMode,
- const bool remove)
+ const std::string& propertyValue, bool appendAsString,
+ bool appendMode, bool remove)
{
for (std::string const& name : names) {
if (status.GetMakefile().IsAlias(name)) {
@@ -300,18 +297,18 @@ bool HandleTargetMode(cmExecutionStatus& status,
bool HandleTarget(cmTarget* target, cmMakefile& makefile,
const std::string& propertyName,
- const std::string& propertyValue, const bool appendAsString,
- const bool appendMode, const bool remove)
+ const std::string& propertyValue, bool appendAsString,
+ bool appendMode, bool remove)
{
// Set or append the property.
- const char* value = propertyValue.c_str();
- if (remove) {
- value = nullptr;
- }
if (appendMode) {
- target->AppendProperty(propertyName, value, appendAsString);
+ target->AppendProperty(propertyName, propertyValue, appendAsString);
} else {
- target->SetProperty(propertyName, value);
+ if (remove) {
+ target->SetProperty(propertyName, nullptr);
+ } else {
+ target->SetProperty(propertyName, propertyValue.c_str());
+ }
}
// Check the resulting value.
@@ -323,9 +320,8 @@ bool HandleTarget(cmTarget* target, cmMakefile& makefile,
bool HandleSourceMode(cmExecutionStatus& status,
const std::set<std::string>& names,
const std::string& propertyName,
- const std::string& propertyValue,
- const bool appendAsString, const bool appendMode,
- const bool remove)
+ const std::string& propertyValue, bool appendAsString,
+ bool appendMode, bool remove)
{
for (std::string const& name : names) {
// Get the source file.
@@ -344,28 +340,26 @@ bool HandleSourceMode(cmExecutionStatus& status,
}
bool HandleSource(cmSourceFile* sf, const std::string& propertyName,
- const std::string& propertyValue, const bool appendAsString,
- const bool appendMode, const bool remove)
+ const std::string& propertyValue, bool appendAsString,
+ bool appendMode, bool remove)
{
// Set or append the property.
- const char* value = propertyValue.c_str();
- if (remove) {
- value = nullptr;
- }
-
if (appendMode) {
- sf->AppendProperty(propertyName, value, appendAsString);
+ sf->AppendProperty(propertyName, propertyValue, appendAsString);
} else {
- sf->SetProperty(propertyName, value);
+ if (remove) {
+ sf->SetProperty(propertyName, nullptr);
+ } else {
+ sf->SetProperty(propertyName, propertyValue.c_str());
+ }
}
return true;
}
bool HandleTestMode(cmExecutionStatus& status, std::set<std::string>& names,
const std::string& propertyName,
- const std::string& propertyValue,
- const bool appendAsString, const bool appendMode,
- const bool remove)
+ const std::string& propertyValue, bool appendAsString,
+ bool appendMode, bool remove)
{
// Look for tests with all names given.
std::set<std::string>::iterator next;
@@ -396,18 +390,18 @@ bool HandleTestMode(cmExecutionStatus& status, std::set<std::string>& names,
}
bool HandleTest(cmTest* test, const std::string& propertyName,
- const std::string& propertyValue, const bool appendAsString,
- const bool appendMode, const bool remove)
+ const std::string& propertyValue, bool appendAsString,
+ bool appendMode, bool remove)
{
// Set or append the property.
- const char* value = propertyValue.c_str();
- if (remove) {
- value = nullptr;
- }
if (appendMode) {
- test->AppendProperty(propertyName, value, appendAsString);
+ test->AppendProperty(propertyName, propertyValue, appendAsString);
} else {
- test->SetProperty(propertyName, value);
+ if (remove) {
+ test->SetProperty(propertyName, nullptr);
+ } else {
+ test->SetProperty(propertyName, propertyValue.c_str());
+ }
}
return true;
@@ -416,9 +410,8 @@ bool HandleTest(cmTest* test, const std::string& propertyName,
bool HandleCacheMode(cmExecutionStatus& status,
const std::set<std::string>& names,
const std::string& propertyName,
- const std::string& propertyValue,
- const bool appendAsString, const bool appendMode,
- const bool remove)
+ const std::string& propertyValue, bool appendAsString,
+ bool appendMode, bool remove)
{
if (propertyName == "ADVANCED") {
if (!remove && !cmIsOn(propertyValue) && !cmIsOff(propertyValue)) {
@@ -463,9 +456,8 @@ bool HandleCacheMode(cmExecutionStatus& status,
bool HandleCacheEntry(std::string const& cacheKey, const cmMakefile& makefile,
const std::string& propertyName,
- const std::string& propertyValue,
- const bool appendAsString, const bool appendMode,
- const bool remove)
+ const std::string& propertyValue, bool appendAsString,
+ bool appendMode, bool remove)
{
// Set or append the property.
const char* value = propertyValue.c_str();
@@ -486,9 +478,8 @@ bool HandleCacheEntry(std::string const& cacheKey, const cmMakefile& makefile,
bool HandleInstallMode(cmExecutionStatus& status,
const std::set<std::string>& names,
const std::string& propertyName,
- const std::string& propertyValue,
- const bool appendAsString, const bool appendMode,
- const bool remove)
+ const std::string& propertyValue, bool appendAsString,
+ bool appendMode, bool remove)
{
cmake* cm = status.GetMakefile().GetCMakeInstance();
@@ -510,8 +501,8 @@ bool HandleInstallMode(cmExecutionStatus& status,
bool HandleInstall(cmInstalledFile* file, cmMakefile& makefile,
const std::string& propertyName,
- const std::string& propertyValue, const bool appendAsString,
- const bool appendMode, const bool remove)
+ const std::string& propertyValue, bool appendAsString,
+ bool appendMode, bool remove)
{
// Set or append the property.
const char* value = propertyValue.c_str();
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx
index 60adf7f4ae..fd9cacdbfe 100644
--- a/Source/cmSourceFile.cxx
+++ b/Source/cmSourceFile.cxx
@@ -260,21 +260,21 @@ void cmSourceFile::SetProperty(const std::string& prop, const char* value)
}
}
-void cmSourceFile::AppendProperty(const std::string& prop, const char* value,
- bool asString)
+void cmSourceFile::AppendProperty(const std::string& prop,
+ const std::string& value, bool asString)
{
if (prop == propINCLUDE_DIRECTORIES) {
- if (value && *value) {
+ if (!value.empty()) {
cmListFileBacktrace lfbt = this->Location.GetMakefile()->GetBacktrace();
this->IncludeDirectories.emplace_back(value, lfbt);
}
} else if (prop == propCOMPILE_OPTIONS) {
- if (value && *value) {
+ if (!value.empty()) {
cmListFileBacktrace lfbt = this->Location.GetMakefile()->GetBacktrace();
this->CompileOptions.emplace_back(value, lfbt);
}
} else if (prop == propCOMPILE_DEFINITIONS) {
- if (value && *value) {
+ if (!value.empty()) {
cmListFileBacktrace lfbt = this->Location.GetMakefile()->GetBacktrace();
this->CompileDefinitions.emplace_back(value, lfbt);
}
diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h
index 19a0d29136..e22829f186 100644
--- a/Source/cmSourceFile.h
+++ b/Source/cmSourceFile.h
@@ -42,7 +42,7 @@ public:
//! Set/Get a property of this source file
void SetProperty(const std::string& prop, const char* value);
- void AppendProperty(const std::string& prop, const char* value,
+ void AppendProperty(const std::string& prop, const std::string& value,
bool asString = false);
//! Might return a nullptr if the property is not set or invalid
const char* GetProperty(const std::string& prop) const;
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 35f07a1d0f..0ce8dd7959 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -557,8 +557,8 @@ void cmState::SetGlobalProperty(const std::string& prop, const char* value)
this->GlobalProperties.SetProperty(prop, value);
}
-void cmState::AppendGlobalProperty(const std::string& prop, const char* value,
- bool asString)
+void cmState::AppendGlobalProperty(const std::string& prop,
+ const std::string& value, bool asString)
{
this->GlobalProperties.AppendProperty(prop, value, asString);
}
diff --git a/Source/cmState.h b/Source/cmState.h
index a74426620c..817046f8f7 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -168,7 +168,7 @@ public:
std::vector<std::string> GetCommandNames() const;
void SetGlobalProperty(const std::string& prop, const char* value);
- void AppendGlobalProperty(const std::string& prop, const char* value,
+ void AppendGlobalProperty(const std::string& prop, const std::string& value,
bool asString = false);
const char* GetGlobalProperty(const std::string& prop);
bool GetGlobalPropertyAsBool(const std::string& prop);
diff --git a/Source/cmStateDirectory.cxx b/Source/cmStateDirectory.cxx
index 97fdbbe1b9..4f003ed8f1 100644
--- a/Source/cmStateDirectory.cxx
+++ b/Source/cmStateDirectory.cxx
@@ -521,7 +521,7 @@ void cmStateDirectory::SetProperty(const std::string& prop, const char* value,
}
void cmStateDirectory::AppendProperty(const std::string& prop,
- const char* value, bool asString,
+ const std::string& value, bool asString,
cmListFileBacktrace const& lfbt)
{
if (prop == "INCLUDE_DIRECTORIES") {
diff --git a/Source/cmStateDirectory.h b/Source/cmStateDirectory.h
index fe15563cbb..53a2d546d8 100644
--- a/Source/cmStateDirectory.h
+++ b/Source/cmStateDirectory.h
@@ -84,7 +84,7 @@ public:
void SetProperty(const std::string& prop, const char* value,
cmListFileBacktrace const& lfbt);
- void AppendProperty(const std::string& prop, const char* value,
+ void AppendProperty(const std::string& prop, const std::string& value,
bool asString, cmListFileBacktrace const& lfbt);
const char* GetProperty(const std::string& prop) const;
const char* GetProperty(const std::string& prop, bool chain) const;
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index d46bf56c46..15e200f220 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1297,8 +1297,8 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
}
}
-void cmTarget::AppendProperty(const std::string& prop, const char* value,
- bool asString)
+void cmTarget::AppendProperty(const std::string& prop,
+ const std::string& value, bool asString)
{
if (!cmTargetPropertyComputer::PassesWhitelist(
this->GetType(), prop, impl->Makefile->GetMessenger(),
@@ -1333,37 +1333,37 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
return;
}
if (prop == "INCLUDE_DIRECTORIES") {
- if (value && *value) {
+ if (!value.empty()) {
impl->IncludeDirectoriesEntries.emplace_back(value);
cmListFileBacktrace lfbt = impl->Makefile->GetBacktrace();
impl->IncludeDirectoriesBacktraces.push_back(lfbt);
}
} else if (prop == "COMPILE_OPTIONS") {
- if (value && *value) {
+ if (!value.empty()) {
impl->CompileOptionsEntries.emplace_back(value);
cmListFileBacktrace lfbt = impl->Makefile->GetBacktrace();
impl->CompileOptionsBacktraces.push_back(lfbt);
}
} else if (prop == "COMPILE_FEATURES") {
- if (value && *value) {
+ if (!value.empty()) {
impl->CompileFeaturesEntries.emplace_back(value);
cmListFileBacktrace lfbt = impl->Makefile->GetBacktrace();
impl->CompileFeaturesBacktraces.push_back(lfbt);
}
} else if (prop == "COMPILE_DEFINITIONS") {
- if (value && *value) {
+ if (!value.empty()) {
impl->CompileDefinitionsEntries.emplace_back(value);
cmListFileBacktrace lfbt = impl->Makefile->GetBacktrace();
impl->CompileDefinitionsBacktraces.push_back(lfbt);
}
} else if (prop == "LINK_OPTIONS") {
- if (value && *value) {
+ if (!value.empty()) {
impl->LinkOptionsEntries.emplace_back(value);
cmListFileBacktrace lfbt = impl->Makefile->GetBacktrace();
impl->LinkOptionsBacktraces.push_back(lfbt);
}
} else if (prop == "LINK_DIRECTORIES") {
- if (value && *value) {
+ if (!value.empty()) {
impl->LinkDirectoriesEntries.emplace_back(value);
cmListFileBacktrace lfbt = impl->Makefile->GetBacktrace();
impl->LinkDirectoriesBacktraces.push_back(lfbt);
@@ -1377,13 +1377,13 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
impl->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
return;
}
- if (value && *value) {
+ if (!value.empty()) {
impl->PrecompileHeadersEntries.emplace_back(value);
cmListFileBacktrace lfbt = impl->Makefile->GetBacktrace();
impl->PrecompileHeadersBacktraces.push_back(lfbt);
}
} else if (prop == "LINK_LIBRARIES") {
- if (value && *value) {
+ if (!value.empty()) {
cmListFileBacktrace lfbt = impl->Makefile->GetBacktrace();
impl->LinkImplementationPropertyEntries.emplace_back(value);
impl->LinkImplementationPropertyBacktraces.push_back(lfbt);
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index ca37f0dace..d4cca2341b 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -166,13 +166,8 @@ public:
{
SetProperty(prop, value.c_str());
}
- void AppendProperty(const std::string& prop, const char* value,
- bool asString = false);
void AppendProperty(const std::string& prop, const std::string& value,
- bool asString = false)
- {
- AppendProperty(prop, value.c_str(), asString);
- }
+ bool asString = false);
//! Might return a nullptr if the property is not set or invalid
const char* GetProperty(const std::string& prop) const;
//! Always returns a valid pointer
diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx
index d5c61c1736..3b731cc5bc 100644
--- a/Source/cmTest.cxx
+++ b/Source/cmTest.cxx
@@ -55,7 +55,7 @@ void cmTest::SetProperty(const std::string& prop, const char* value)
this->Properties.SetProperty(prop, value);
}
-void cmTest::AppendProperty(const std::string& prop, const char* value,
+void cmTest::AppendProperty(const std::string& prop, const std::string& value,
bool asString)
{
this->Properties.AppendProperty(prop, value, asString);
diff --git a/Source/cmTest.h b/Source/cmTest.h
index dd246c4e6b..72d4ed9165 100644
--- a/Source/cmTest.h
+++ b/Source/cmTest.h
@@ -35,7 +35,7 @@ public:
//! Set/Get a property of this source file
void SetProperty(const std::string& prop, const char* value);
- void AppendProperty(const std::string& prop, const char* value,
+ void AppendProperty(const std::string& prop, const std::string& value,
bool asString = false);
const char* GetProperty(const std::string& prop) const;
bool GetPropertyAsBool(const std::string& prop) const;
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index ab76df9103..721d53528a 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2374,7 +2374,7 @@ void cmake::SetProperty(const std::string& prop, const char* value)
this->State->SetGlobalProperty(prop, value);
}
-void cmake::AppendProperty(const std::string& prop, const char* value,
+void cmake::AppendProperty(const std::string& prop, const std::string& value,
bool asString)
{
this->State->AppendGlobalProperty(prop, value, asString);
diff --git a/Source/cmake.h b/Source/cmake.h
index 22d3c39b0b..c65b821e86 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -359,7 +359,7 @@ public:
//! Set/Get a property of this target file
void SetProperty(const std::string& prop, const char* value);
- void AppendProperty(const std::string& prop, const char* value,
+ void AppendProperty(const std::string& prop, const std::string& value,
bool asString = false);
const char* GetProperty(const std::string& prop);
bool GetPropertyAsBool(const std::string& prop);