From c2eeb08b06d422c7b72aa9e6431e6e7584ce8c74 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 21 May 2014 09:34:32 -0400 Subject: cmTarget: Add GetFeatureAsBool method Return the GetFeature method result converted to a boolean value. --- Source/cmMakefileTargetGenerator.cxx | 2 +- Source/cmNinjaTargetGenerator.cxx | 2 +- Source/cmTarget.cxx | 7 +++++++ Source/cmTarget.h | 2 ++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 73d24a9..a08d731 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -2105,7 +2105,7 @@ const char* cmMakefileTargetGenerator::GetFeature(const std::string& feature) //---------------------------------------------------------------------------- bool cmMakefileTargetGenerator::GetFeatureAsBool(const std::string& feature) { - return cmSystemTools::IsOn(this->GetFeature(feature)); + return this->Target->GetFeatureAsBool(feature, this->ConfigName); } //---------------------------------------------------------------------------- diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 54e398c..c3b4c75 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -105,7 +105,7 @@ const char* cmNinjaTargetGenerator::GetFeature(const std::string& feature) // TODO: Picked up from cmMakefileTargetGenerator. Refactor it. bool cmNinjaTargetGenerator::GetFeatureAsBool(const std::string& feature) { - return cmSystemTools::IsOn(this->GetFeature(feature)); + return this->Target->GetFeatureAsBool(feature, this->GetConfigName()); } // TODO: Picked up from cmMakefileTargetGenerator. Refactor it. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 86842a4..d8b7373 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -3181,6 +3181,13 @@ const char* cmTarget::GetFeature(const std::string& feature, } //---------------------------------------------------------------------------- +bool cmTarget::GetFeatureAsBool(const std::string& feature, + const std::string& config) const +{ + return cmSystemTools::IsOn(this->GetFeature(feature, config)); +} + +//---------------------------------------------------------------------------- bool cmTarget::HandleLocationPropertyPolicy(cmMakefile* context) const { if (this->IsImported()) diff --git a/Source/cmTarget.h b/Source/cmTarget.h index bee6b34..93e1b5b 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -237,6 +237,8 @@ public: const char* GetFeature(const std::string& feature, const std::string& config) const; + bool GetFeatureAsBool(const std::string& feature, + const std::string& config) const; bool IsImported() const {return this->IsImportedTarget;} -- cgit v0.12