summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorVitaly Stakhovsky <vvs31415@gitlab.org>2020-03-22 07:00:00 (GMT)
committerVitaly Stakhovsky <vvs31415@gitlab.org>2020-03-25 13:10:46 (GMT)
commitc84cf42897e4d95706d4f750c2ad085c84a259f2 (patch)
tree980169e295b16dbc56fe3577b48913fd4a9c2e8a /Source
parentd13d5c11cf8b5878c5e63b067e73a2175f01d93f (diff)
downloadCMake-c84cf42897e4d95706d4f750c2ad085c84a259f2.zip
CMake-c84cf42897e4d95706d4f750c2ad085c84a259f2.tar.gz
CMake-c84cf42897e4d95706d4f750c2ad085c84a259f2.tar.bz2
cmState::GetGlobalProperty: return cmProp
Diffstat (limited to 'Source')
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx9
-rw-r--r--Source/cmCTest.cxx13
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx8
-rw-r--r--Source/cmFindPackageCommand.cxx16
-rw-r--r--Source/cmGetCMakePropertyCommand.cxx4
-rw-r--r--Source/cmGetPropertyCommand.cxx3
-rw-r--r--Source/cmGlobalGenerator.cxx17
-rw-r--r--Source/cmGlobalGenerator.h2
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx4
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx7
-rw-r--r--Source/cmLocalNinjaGenerator.cxx6
-rw-r--r--Source/cmMakefileTargetGenerator.cxx5
-rw-r--r--Source/cmQtAutoGenGlobalInitializer.cxx4
-rw-r--r--Source/cmQtAutoGenInitializer.cxx18
-rw-r--r--Source/cmState.cxx44
-rw-r--r--Source/cmState.h2
-rw-r--r--Source/cmStateDirectory.cxx2
-rw-r--r--Source/cmake.cxx12
-rw-r--r--Source/cmake.h2
19 files changed, 95 insertions, 83 deletions
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index 22ab48f..cfa5817 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -260,11 +260,10 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
cmCTestScriptHandler* ch = this->CTest->GetScriptHandler();
cmake* cm = ch->GetCMake();
if (cm) {
- const char* subproject =
- cm->GetState()->GetGlobalProperty("SubProject");
+ cmProp subproject = cm->GetState()->GetGlobalProperty("SubProject");
if (subproject) {
upload_as += "&subproject=";
- upload_as += ctest_curl.Escape(subproject);
+ upload_as += ctest_curl.Escape(*subproject);
}
}
}
@@ -555,11 +554,11 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
// a "&subproject=subprojectname" to the first POST.
cmCTestScriptHandler* ch = this->CTest->GetScriptHandler();
cmake* cm = ch->GetCMake();
- const char* subproject = cm->GetState()->GetGlobalProperty("SubProject");
+ cmProp subproject = cm->GetState()->GetGlobalProperty("SubProject");
// TODO: Encode values for a URL instead of trusting caller.
std::ostringstream str;
if (subproject) {
- str << "subproject=" << curl.Escape(subproject) << "&";
+ str << "subproject=" << curl.Escape(*subproject) << "&";
}
auto timeNow =
std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index fb100b1..86816db 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -1439,16 +1439,15 @@ void cmCTest::AddSiteProperties(cmXMLWriter& xml)
return;
}
// This code should go when cdash is changed to use labels only
- const char* subproject = cm->GetState()->GetGlobalProperty("SubProject");
+ cmProp subproject = cm->GetState()->GetGlobalProperty("SubProject");
if (subproject) {
xml.StartElement("Subproject");
- xml.Attribute("name", subproject);
- const char* labels =
+ xml.Attribute("name", *subproject);
+ cmProp labels =
ch->GetCMake()->GetState()->GetGlobalProperty("SubProjectLabels");
if (labels) {
xml.StartElement("Labels");
- std::string l = labels;
- std::vector<std::string> args = cmExpandedList(l);
+ std::vector<std::string> args = cmExpandedList(*labels);
for (std::string const& i : args) {
xml.Element("Label", i);
}
@@ -1458,10 +1457,10 @@ void cmCTest::AddSiteProperties(cmXMLWriter& xml)
}
// This code should stay when cdash only does label based sub-projects
- const char* label = cm->GetState()->GetGlobalProperty("Label");
+ cmProp label = cm->GetState()->GetGlobalProperty("Label");
if (label) {
xml.StartElement("Labels");
- xml.Element("Label", label);
+ xml.Element("Label", *label);
xml.EndElement();
}
}
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 8ab30c0..1b1b644 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -415,9 +415,9 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
xml.Element("nature", n);
}
- if (const char* extraNaturesProp =
+ if (cmProp extraNaturesProp =
mf->GetState()->GetGlobalProperty("ECLIPSE_EXTRA_NATURES")) {
- std::vector<std::string> extraNatures = cmExpandedList(extraNaturesProp);
+ std::vector<std::string> extraNatures = cmExpandedList(*extraNaturesProp);
for (std::string const& n : extraNatures) {
xml.Element("nature", n);
}
@@ -1033,9 +1033,9 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
xml.EndElement(); // storageModule
// Append additional cproject contents without applying any XML formatting
- if (const char* extraCProjectContents =
+ if (cmProp extraCProjectContents =
mf->GetState()->GetGlobalProperty("ECLIPSE_EXTRA_CPROJECT_CONTENTS")) {
- fout << extraCProjectContents;
+ fout << *extraCProjectContents;
}
xml.EndElement(); // cproject
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index f606002..e996327 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -1114,12 +1114,10 @@ bool cmFindPackageCommand::ReadListFile(const std::string& f,
void cmFindPackageCommand::AppendToFoundProperty(bool found)
{
std::vector<std::string> foundContents;
- const char* foundProp =
+ cmProp foundProp =
this->Makefile->GetState()->GetGlobalProperty("PACKAGES_FOUND");
- if (foundProp && *foundProp) {
- std::string tmp = foundProp;
-
- cmExpandList(tmp, foundContents, false);
+ if (foundProp && !foundProp->empty()) {
+ cmExpandList(*foundProp, foundContents, false);
auto nameIt =
std::find(foundContents.begin(), foundContents.end(), this->Name);
if (nameIt != foundContents.end()) {
@@ -1128,12 +1126,10 @@ void cmFindPackageCommand::AppendToFoundProperty(bool found)
}
std::vector<std::string> notFoundContents;
- const char* notFoundProp =
+ cmProp notFoundProp =
this->Makefile->GetState()->GetGlobalProperty("PACKAGES_NOT_FOUND");
- if (notFoundProp && *notFoundProp) {
- std::string tmp = notFoundProp;
-
- cmExpandList(tmp, notFoundContents, false);
+ if (notFoundProp && !notFoundProp->empty()) {
+ cmExpandList(*notFoundProp, notFoundContents, false);
auto nameIt =
std::find(notFoundContents.begin(), notFoundContents.end(), this->Name);
if (nameIt != notFoundContents.end()) {
diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx
index ff4e312..4a9509b 100644
--- a/Source/cmGetCMakePropertyCommand.cxx
+++ b/Source/cmGetCMakePropertyCommand.cxx
@@ -36,12 +36,12 @@ bool cmGetCMakePropertyCommand(std::vector<std::string> const& args,
status.GetMakefile().GetGlobalGenerator()->GetInstallComponents();
output = cmJoin(*components, ";");
} else {
- const char* prop = nullptr;
+ cmProp prop = nullptr;
if (!args[1].empty()) {
prop = status.GetMakefile().GetState()->GetGlobalProperty(args[1]);
}
if (prop) {
- output = prop;
+ output = *prop;
}
}
diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx
index 947d893..5e034a4 100644
--- a/Source/cmGetPropertyCommand.cxx
+++ b/Source/cmGetPropertyCommand.cxx
@@ -241,8 +241,9 @@ bool HandleGlobalMode(cmExecutionStatus& status, const std::string& name,
// Get the property.
cmake* cm = status.GetMakefile().GetCMakeInstance();
+ cmProp p = cm->GetState()->GetGlobalProperty(propertyName);
return StoreResult(infoType, status.GetMakefile(), variable,
- cm->GetState()->GetGlobalProperty(propertyName));
+ p ? p->c_str() : nullptr);
}
bool HandleDirectoryMode(cmExecutionStatus& status, const std::string& name,
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 0e10734..6d08369 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -246,11 +246,10 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string& lang,
cmSystemTools::ConvertToUnixSlashes(cnameString);
cmSystemTools::ConvertToUnixSlashes(pathString);
if (cnameString != pathString) {
- const char* cvars =
- this->GetCMakeInstance()->GetState()->GetGlobalProperty(
- "__CMAKE_DELETE_CACHE_CHANGE_VARS_");
+ cmProp cvars = this->GetCMakeInstance()->GetState()->GetGlobalProperty(
+ "__CMAKE_DELETE_CACHE_CHANGE_VARS_");
if (cvars) {
- changeVars += cvars;
+ changeVars += *cvars;
changeVars += ";";
}
changeVars += langComp;
@@ -2674,13 +2673,13 @@ void cmGlobalGenerator::AddGlobalTarget_Install(
}
}
-const char* cmGlobalGenerator::GetPredefinedTargetsFolder()
+std::string cmGlobalGenerator::GetPredefinedTargetsFolder()
{
- const char* prop = this->GetCMakeInstance()->GetState()->GetGlobalProperty(
+ cmProp prop = this->GetCMakeInstance()->GetState()->GetGlobalProperty(
"PREDEFINED_TARGETS_FOLDER");
if (prop) {
- return prop;
+ return *prop;
}
return "CMakePredefinedTargets";
@@ -2688,13 +2687,13 @@ const char* cmGlobalGenerator::GetPredefinedTargetsFolder()
bool cmGlobalGenerator::UseFolderProperty() const
{
- const char* prop =
+ cmProp prop =
this->GetCMakeInstance()->GetState()->GetGlobalProperty("USE_FOLDERS");
// If this property is defined, let the setter turn this on or off...
//
if (prop) {
- return cmIsOn(prop);
+ return cmIsOn(*prop);
}
// By default, this feature is OFF, since it is not supported in the
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 7dc4822..70e43b5 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -588,7 +588,7 @@ protected:
cmGeneratorTarget* FindGeneratorTargetImpl(std::string const& name) const;
- const char* GetPredefinedTargetsFolder();
+ std::string GetPredefinedTargetsFolder();
private:
using TargetMap = std::unordered_map<std::string, cmTarget*>;
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 7daca74..336bfc6 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -674,10 +674,10 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2(
}
bool targetMessages = true;
- if (const char* tgtMsg =
+ if (cmProp tgtMsg =
this->GetCMakeInstance()->GetState()->GetGlobalProperty(
"TARGET_MESSAGES")) {
- targetMessages = cmIsOn(tgtMsg);
+ targetMessages = cmIsOn(*tgtMsg);
}
if (targetMessages) {
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 9db4817..a672459 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -3695,15 +3695,14 @@ bool cmGlobalXCodeGenerator::HasKnownObjectFileLocation(
bool cmGlobalXCodeGenerator::UseEffectivePlatformName(cmMakefile* mf) const
{
- const char* epnValue =
- this->GetCMakeInstance()->GetState()->GetGlobalProperty(
- "XCODE_EMIT_EFFECTIVE_PLATFORM_NAME");
+ cmProp epnValue = this->GetCMakeInstance()->GetState()->GetGlobalProperty(
+ "XCODE_EMIT_EFFECTIVE_PLATFORM_NAME");
if (!epnValue) {
return mf->PlatformIsAppleEmbedded();
}
- return cmIsOn(epnValue);
+ return cmIsOn(*epnValue);
}
bool cmGlobalXCodeGenerator::ShouldStripResourcePath(cmMakefile*) const
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index be1dd0d..248b3f1 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -251,15 +251,15 @@ void cmLocalNinjaGenerator::WritePools(std::ostream& os)
{
cmGlobalNinjaGenerator::WriteDivider(os);
- const char* jobpools =
+ cmProp jobpools =
this->GetCMakeInstance()->GetState()->GetGlobalProperty("JOB_POOLS");
if (!jobpools) {
- jobpools = this->GetMakefile()->GetDefinition("CMAKE_JOB_POOLS");
+ jobpools = this->GetMakefile()->GetDef("CMAKE_JOB_POOLS");
}
if (jobpools) {
cmGlobalNinjaGenerator::WriteComment(
os, "Pools defined by global property JOB_POOLS");
- std::vector<std::string> pools = cmExpandedList(jobpools);
+ std::vector<std::string> pools = cmExpandedList(*jobpools);
for (std::string const& pool : pools) {
const std::string::size_type eq = pool.find('=');
unsigned int jobs;
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 451f19e..428dc8e 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -46,9 +46,8 @@ cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmGeneratorTarget* target)
this->LocalGenerator->GetGlobalGenerator());
cmake* cm = this->GlobalGenerator->GetCMakeInstance();
this->NoRuleMessages = false;
- if (const char* ruleStatus =
- cm->GetState()->GetGlobalProperty("RULE_MESSAGES")) {
- this->NoRuleMessages = cmIsOff(ruleStatus);
+ if (cmProp ruleStatus = cm->GetState()->GetGlobalProperty("RULE_MESSAGES")) {
+ this->NoRuleMessages = cmIsOff(*ruleStatus);
}
MacOSXContentGenerator = cm::make_unique<MacOSXContentGeneratorType>(this);
}
diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx
index 7a6cb42..18b135d 100644
--- a/Source/cmQtAutoGenGlobalInitializer.cxx
+++ b/Source/cmQtAutoGenGlobalInitializer.cxx
@@ -164,10 +164,10 @@ void cmQtAutoGenGlobalInitializer::GetOrCreateGlobalTarget(
// Set FOLDER property in the target
{
- char const* folder =
+ cmProp folder =
makefile->GetState()->GetGlobalProperty("AUTOGEN_TARGETS_FOLDER");
if (folder != nullptr) {
- target->SetProperty("FOLDER", folder);
+ target->SetProperty("FOLDER", *folder);
}
}
}
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index 629367d..dddba0a 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -339,15 +339,18 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
// Targets FOLDER
{
- const char* folder =
+ cmProp prop =
this->Makefile->GetState()->GetGlobalProperty("AUTOMOC_TARGETS_FOLDER");
- if (folder == nullptr) {
- folder = this->Makefile->GetState()->GetGlobalProperty(
+ if (prop == nullptr) {
+ prop = this->Makefile->GetState()->GetGlobalProperty(
"AUTOGEN_TARGETS_FOLDER");
}
+ const char* folder;
// Inherit FOLDER property from target (#13688)
- if (folder == nullptr) {
+ if (prop == nullptr) {
folder = this->GenTarget->GetProperty("FOLDER");
+ } else {
+ folder = prop->c_str();
}
if (folder != nullptr) {
this->TargetsFolder = folder;
@@ -1604,10 +1607,9 @@ void cmQtAutoGenInitializer::AddToSourceGroup(std::string const& fileName,
cmStrCat(genNameUpper, "_SOURCE_GROUP"), "AUTOGEN_SOURCE_GROUP"
};
for (std::string const& prop : props) {
- const char* propName =
- this->Makefile->GetState()->GetGlobalProperty(prop);
- if ((propName != nullptr) && (*propName != '\0')) {
- groupName = propName;
+ cmProp propName = this->Makefile->GetState()->GetGlobalProperty(prop);
+ if (propName && !propName->empty()) {
+ groupName = *propName;
property = prop;
break;
}
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index b1fa772..1ba1d10 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -573,7 +573,7 @@ void cmState::AppendGlobalProperty(const std::string& prop,
this->GlobalProperties.AppendProperty(prop, value, asString);
}
-const char* cmState::GetGlobalProperty(const std::string& prop)
+cmProp cmState::GetGlobalProperty(const std::string& prop)
{
if (prop == "CACHE_VARIABLES") {
std::vector<std::string> cacheKeys = this->GetCacheEntryKeys();
@@ -597,41 +597,59 @@ const char* cmState::GetGlobalProperty(const std::string& prop)
}
#define STRING_LIST_ELEMENT(F) ";" #F
if (prop == "CMAKE_C_KNOWN_FEATURES") {
- return &FOR_EACH_C_FEATURE(STRING_LIST_ELEMENT)[1];
+ static const std::string s_out(
+ &FOR_EACH_C_FEATURE(STRING_LIST_ELEMENT)[1]);
+ return &s_out;
}
if (prop == "CMAKE_C90_KNOWN_FEATURES") {
- return &FOR_EACH_C90_FEATURE(STRING_LIST_ELEMENT)[1];
+ static const std::string s_out(
+ &FOR_EACH_C90_FEATURE(STRING_LIST_ELEMENT)[1]);
+ return &s_out;
}
if (prop == "CMAKE_C99_KNOWN_FEATURES") {
- return &FOR_EACH_C99_FEATURE(STRING_LIST_ELEMENT)[1];
+ static const std::string s_out(
+ &FOR_EACH_C99_FEATURE(STRING_LIST_ELEMENT)[1]);
+ return &s_out;
}
if (prop == "CMAKE_C11_KNOWN_FEATURES") {
- return &FOR_EACH_C11_FEATURE(STRING_LIST_ELEMENT)[1];
+ static const std::string s_out(
+ &FOR_EACH_C11_FEATURE(STRING_LIST_ELEMENT)[1]);
+ return &s_out;
}
if (prop == "CMAKE_CXX_KNOWN_FEATURES") {
- return &FOR_EACH_CXX_FEATURE(STRING_LIST_ELEMENT)[1];
+ static const std::string s_out(
+ &FOR_EACH_CXX_FEATURE(STRING_LIST_ELEMENT)[1]);
+ return &s_out;
}
if (prop == "CMAKE_CXX98_KNOWN_FEATURES") {
- return &FOR_EACH_CXX98_FEATURE(STRING_LIST_ELEMENT)[1];
+ static const std::string s_out(
+ &FOR_EACH_CXX98_FEATURE(STRING_LIST_ELEMENT)[1]);
+ return &s_out;
}
if (prop == "CMAKE_CXX11_KNOWN_FEATURES") {
- return &FOR_EACH_CXX11_FEATURE(STRING_LIST_ELEMENT)[1];
+ static const std::string s_out(
+ &FOR_EACH_CXX11_FEATURE(STRING_LIST_ELEMENT)[1]);
+ return &s_out;
}
if (prop == "CMAKE_CXX14_KNOWN_FEATURES") {
- return &FOR_EACH_CXX14_FEATURE(STRING_LIST_ELEMENT)[1];
+ static const std::string s_out(
+ &FOR_EACH_CXX14_FEATURE(STRING_LIST_ELEMENT)[1]);
+ return &s_out;
}
if (prop == "CMAKE_CUDA_KNOWN_FEATURES") {
- return &FOR_EACH_CUDA_FEATURE(STRING_LIST_ELEMENT)[1];
+ static const std::string s_out(
+ &FOR_EACH_CUDA_FEATURE(STRING_LIST_ELEMENT)[1]);
+ return &s_out;
}
#undef STRING_LIST_ELEMENT
- cmProp retVal = this->GlobalProperties.GetPropertyValue(prop);
- return retVal ? retVal->c_str() : nullptr;
+ return this->GlobalProperties.GetPropertyValue(prop);
}
bool cmState::GetGlobalPropertyAsBool(const std::string& prop)
{
- return cmIsOn(this->GetGlobalProperty(prop));
+ cmProp p = this->GetGlobalProperty(prop);
+ return p && cmIsOn(*p);
}
void cmState::SetSourceDirectory(std::string const& sourceDirectory)
diff --git a/Source/cmState.h b/Source/cmState.h
index b577a72..8d6bd7b 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -173,7 +173,7 @@ public:
void SetGlobalProperty(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);
+ cmProp GetGlobalProperty(const std::string& prop);
bool GetGlobalPropertyAsBool(const std::string& prop);
std::string const& GetSourceDirectory() const;
diff --git a/Source/cmStateDirectory.cxx b/Source/cmStateDirectory.cxx
index e7de3c7..2ce7530 100644
--- a/Source/cmStateDirectory.cxx
+++ b/Source/cmStateDirectory.cxx
@@ -641,7 +641,7 @@ const char* cmStateDirectory::GetProperty(const std::string& prop,
if (parentSnapshot.IsValid()) {
return parentSnapshot.GetDirectory().GetProperty(prop, chain);
}
- return this->Snapshot_.State->GetGlobalProperty(prop);
+ retVal = this->Snapshot_.State->GetGlobalProperty(prop);
}
return retVal ? retVal->c_str() : nullptr;
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index f26fce9..63bff83 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -1510,10 +1510,10 @@ int cmake::Configure()
this->Messenger->SetDevWarningsAsErrors(value && cmIsOff(*value));
int ret = this->ActualConfigure();
- const char* delCacheVars =
+ cmProp delCacheVars =
this->State->GetGlobalProperty("__CMAKE_DELETE_CACHE_CHANGE_VARS_");
- if (delCacheVars && delCacheVars[0] != 0) {
- return this->HandleDeleteCacheVariables(delCacheVars);
+ if (delCacheVars && !delCacheVars->empty()) {
+ return this->HandleDeleteCacheVariables(*delCacheVars);
}
return ret;
}
@@ -2428,7 +2428,7 @@ void cmake::AppendProperty(const std::string& prop, const std::string& value,
this->State->AppendGlobalProperty(prop, value, asString);
}
-const char* cmake::GetProperty(const std::string& prop)
+cmProp cmake::GetProperty(const std::string& prop)
{
return this->State->GetGlobalProperty(prop);
}
@@ -2669,10 +2669,10 @@ void cmake::IssueMessage(MessageType t, std::string const& text,
std::vector<std::string> cmake::GetDebugConfigs()
{
std::vector<std::string> configs;
- if (const char* config_list =
+ if (cmProp config_list =
this->State->GetGlobalProperty("DEBUG_CONFIGURATIONS")) {
// Expand the specified list and convert to upper-case.
- cmExpandList(config_list, configs);
+ cmExpandList(*config_list, configs);
std::transform(configs.begin(), configs.end(), configs.begin(),
cmSystemTools::UpperCase);
}
diff --git a/Source/cmake.h b/Source/cmake.h
index 58769fd..7705f0e 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -364,7 +364,7 @@ public:
void SetProperty(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);
+ cmProp GetProperty(const std::string& prop);
bool GetPropertyAsBool(const std::string& prop);
//! Get or create an cmInstalledFile instance and return a pointer to it