summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.cxx
diff options
context:
space:
mode:
authorVitaly Stakhovsky <vvs31415@gitlab.org>2018-09-06 00:08:17 (GMT)
committerVitaly Stakhovsky <vvs31415@gitlab.org>2018-09-06 00:08:17 (GMT)
commit437d0c16c72a45da8c81919f953859f5af71b19b (patch)
tree2a456a93a0eddf55d46313bd6d1bfbe668324d22 /Source/cmMakefile.cxx
parentb0f769ad2da5162f7f65e13061b18b4538f06d9a (diff)
downloadCMake-437d0c16c72a45da8c81919f953859f5af71b19b.zip
CMake-437d0c16c72a45da8c81919f953859f5af71b19b.tar.gz
CMake-437d0c16c72a45da8c81919f953859f5af71b19b.tar.bz2
cmStateSnapshot::GetDefinition(): Return std::string const*
Expose std::string type used internally in cmDefinitions instead of const char*
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r--Source/cmMakefile.cxx17
1 files changed, 11 insertions, 6 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 6127b57..8d2f932 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2368,8 +2368,10 @@ const char* cmMakefile::GetRequiredDefinition(const std::string& name) const
bool cmMakefile::IsDefinitionSet(const std::string& name) const
{
- const char* def = this->StateSnapshot.GetDefinition(name);
- if (!def) {
+ const char* def;
+ if (const std::string* d = this->StateSnapshot.GetDefinition(name)) {
+ def = d->c_str();
+ } else {
def = this->GetState()->GetInitializedCacheValue(name);
}
#ifdef CMAKE_BUILD_WITH_CMAKE
@@ -2385,8 +2387,10 @@ bool cmMakefile::IsDefinitionSet(const std::string& name) const
const char* cmMakefile::GetDefinition(const std::string& name) const
{
- const char* def = this->StateSnapshot.GetDefinition(name);
- if (!def) {
+ const char* def;
+ if (const std::string* d = this->StateSnapshot.GetDefinition(name)) {
+ def = d->c_str();
+ } else {
def = this->GetState()->GetInitializedCacheValue(name);
}
#ifdef CMAKE_BUILD_WITH_CMAKE
@@ -2402,8 +2406,9 @@ const char* cmMakefile::GetDefinition(const std::string& name) const
// A callback was executed and may have caused re-allocation of the
// variable storage. Look it up again for now.
// FIXME: Refactor variable storage to avoid this problem.
- def = this->StateSnapshot.GetDefinition(name);
- if (!def) {
+ if (const std::string* d = this->StateSnapshot.GetDefinition(name)) {
+ def = d->c_str();
+ } else {
def = this->GetState()->GetInitializedCacheValue(name);
}
}