cmTarget: Add GetFeatureAsBool method

Return the GetFeature method result converted to a boolean value.
This commit is contained in:
Brad King 2014-05-21 09:34:32 -04:00
parent f7654a07d5
commit c2eeb08b06
4 changed files with 11 additions and 2 deletions

View File

@ -2105,7 +2105,7 @@ const char* cmMakefileTargetGenerator::GetFeature(const std::string& feature)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmMakefileTargetGenerator::GetFeatureAsBool(const std::string& feature) bool cmMakefileTargetGenerator::GetFeatureAsBool(const std::string& feature)
{ {
return cmSystemTools::IsOn(this->GetFeature(feature)); return this->Target->GetFeatureAsBool(feature, this->ConfigName);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -105,7 +105,7 @@ const char* cmNinjaTargetGenerator::GetFeature(const std::string& feature)
// TODO: Picked up from cmMakefileTargetGenerator. Refactor it. // TODO: Picked up from cmMakefileTargetGenerator. Refactor it.
bool cmNinjaTargetGenerator::GetFeatureAsBool(const std::string& feature) 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. // TODO: Picked up from cmMakefileTargetGenerator. Refactor it.

View File

@ -3180,6 +3180,13 @@ const char* cmTarget::GetFeature(const std::string& feature,
return this->Makefile->GetFeature(feature, config); return this->Makefile->GetFeature(feature, config);
} }
//----------------------------------------------------------------------------
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 bool cmTarget::HandleLocationPropertyPolicy(cmMakefile* context) const
{ {

View File

@ -237,6 +237,8 @@ public:
const char* GetFeature(const std::string& feature, const char* GetFeature(const std::string& feature,
const std::string& config) const; const std::string& config) const;
bool GetFeatureAsBool(const std::string& feature,
const std::string& config) const;
bool IsImported() const {return this->IsImportedTarget;} bool IsImported() const {return this->IsImportedTarget;}