diff options
author | Vitaly Stakhovsky <vvs31415@gitlab.org> | 2019-02-06 22:44:53 (GMT) |
---|---|---|
committer | Vitaly Stakhovsky <vvs31415@gitlab.org> | 2019-02-07 12:35:16 (GMT) |
commit | 00ba28ffd03a9a0cf00d78001573bc5cc045ee72 (patch) | |
tree | bb8c241b1938470badd41ecf2499a48317b11e1d /Source/cmMakefile.cxx | |
parent | 0741eda2468e482baf1b5ff6a3a8d376143171e4 (diff) | |
download | CMake-00ba28ffd03a9a0cf00d78001573bc5cc045ee72.zip CMake-00ba28ffd03a9a0cf00d78001573bc5cc045ee72.tar.gz CMake-00ba28ffd03a9a0cf00d78001573bc5cc045ee72.tar.bz2 |
cmMakefile::GetRequiredDefinition: return const std::string&
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r-- | Source/cmMakefile.cxx | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ab139c0..dcdaa13 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2425,16 +2425,18 @@ bool cmMakefile::CanIWriteThisFile(std::string const& fileName) const cmSystemTools::SameFile(fileName, this->GetHomeOutputDirectory()); } -std::string cmMakefile::GetRequiredDefinition(const std::string& name) const +const std::string& cmMakefile::GetRequiredDefinition( + const std::string& name) const { - const char* ret = this->GetDefinition(name); - if (!ret) { + static std::string const empty; + const std::string* def = GetDef(name); + if (!def) { cmSystemTools::Error("Error required internal CMake variable not " "set, cmake may not be built correctly.\n", "Missing variable is:\n", name.c_str()); - return std::string(); + return empty; } - return std::string(ret); + return *def; } bool cmMakefile::IsDefinitionSet(const std::string& name) const |