diff options
author | Brad King <brad.king@kitware.com> | 2018-09-07 20:07:48 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-09-07 20:08:02 (GMT) |
commit | 917d98699e8dd13de89e2993b0b630cf64f17706 (patch) | |
tree | 1ad51b87b52747e90ec15698eb613a0afe2a75f8 /Source/cmMakefile.cxx | |
parent | 424d86be5b332d2f5b85dfd2ba2900430f7e02c3 (diff) | |
parent | 437d0c16c72a45da8c81919f953859f5af71b19b (diff) | |
download | CMake-917d98699e8dd13de89e2993b0b630cf64f17706.zip CMake-917d98699e8dd13de89e2993b0b630cf64f17706.tar.gz CMake-917d98699e8dd13de89e2993b0b630cf64f17706.tar.bz2 |
Merge topic 'definitions-get'
437d0c16c7 cmStateSnapshot::GetDefinition(): Return std::string const*
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2356
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r-- | Source/cmMakefile.cxx | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 11019d7..5498ad2 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2368,8 +2368,10 @@ std::string 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); } } |