From 8fc53c3ce89e76a4e5cf1968307c513041e9a7b7 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 8 Jun 2015 22:00:37 +0200 Subject: [PATCH] cmGetDirectoryPropertyCommand: Extract StoreResult method. --- Source/cmGetDirectoryPropertyCommand.cxx | 18 ++++++++++++------ Source/cmGetDirectoryPropertyCommand.h | 5 +++-- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx index 228e53cd2..bb1801ca0 100644 --- a/Source/cmGetDirectoryPropertyCommand.cxx +++ b/Source/cmGetDirectoryPropertyCommand.cxx @@ -89,12 +89,18 @@ bool cmGetDirectoryPropertyCommand { prop = dir->GetProperty(*i); } - if (prop) - { - this->Makefile->AddDefinition(variable, prop); - return true; - } - this->Makefile->AddDefinition(variable, ""); + this->StoreResult(variable, prop); return true; } +void cmGetDirectoryPropertyCommand::StoreResult(std::string const& variable, + const char* prop) +{ + if (prop) + { + this->Makefile->AddDefinition(variable, prop); + return; + } + this->Makefile->AddDefinition(variable, ""); +} + diff --git a/Source/cmGetDirectoryPropertyCommand.h b/Source/cmGetDirectoryPropertyCommand.h index 6c5750a9c..f4188861f 100644 --- a/Source/cmGetDirectoryPropertyCommand.h +++ b/Source/cmGetDirectoryPropertyCommand.h @@ -40,8 +40,9 @@ public: virtual std::string GetName() const { return "get_directory_property";} cmTypeMacro(cmGetDirectoryPropertyCommand, cmCommand); + +private: + void StoreResult(const std::string& variable, const char* prop); }; - - #endif