From e09e1679abf03b4a6efffa52dba99852a2ccba01 Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Tue, 27 Apr 2004 11:30:31 -0400 Subject: ENH: Add method to get definition even if it does not exists --- Source/cmMakefile.cxx | 10 ++++++++++ Source/cmMakefile.h | 1 + 2 files changed, 11 insertions(+) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index b073bf9..c85ad61 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1378,6 +1378,16 @@ const char* cmMakefile::GetDefinition(const char* name) const return def; } +const char* cmMakefile::GetSafeDefinition(const char* def) const +{ + const char* ret = this->GetDefinition(def); + if(!ret) + { + return ""; + } + return ret; +} + std::vector cmMakefile::GetDefinitions(int cacheonly /* = 0 */) const { std::map definitions; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index c35cf43..8b60aad 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -502,6 +502,7 @@ public: * cache is then queried. */ const char* GetDefinition(const char*) const; + const char* GetSafeDefinition(const char*) const; /** * Get the list of all variables in the current space. If argument -- cgit v0.12