GetFeature(): return cmProp

This commit is contained in:
Vitaly Stakhovsky
2020-07-11 14:00:00 -04:00
parent fd1df4995b
commit 18726ad634
6 changed files with 16 additions and 17 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ std::vector<std::string> const& cmCommonTargetGenerator::GetConfigNames() const
const char* cmCommonTargetGenerator::GetFeature(const std::string& feature, const char* cmCommonTargetGenerator::GetFeature(const std::string& feature,
const std::string& config) const std::string& config)
{ {
return this->GeneratorTarget->GetFeature(feature, config); return this->GeneratorTarget->GetFeature(feature, config)->c_str();
} }
void cmCommonTargetGenerator::AddModuleDefinitionFlag( void cmCommonTargetGenerator::AddModuleDefinitionFlag(
+6 -6
View File
@@ -815,18 +815,18 @@ void cmGeneratorTarget::ComputeObjectMapping()
} }
} }
const char* cmGeneratorTarget::GetFeature(const std::string& feature, cmProp cmGeneratorTarget::GetFeature(const std::string& feature,
const std::string& config) const const std::string& config) const
{ {
if (!config.empty()) { if (!config.empty()) {
std::string featureConfig = std::string featureConfig =
cmStrCat(feature, '_', cmSystemTools::UpperCase(config)); cmStrCat(feature, '_', cmSystemTools::UpperCase(config));
if (cmProp value = this->GetProperty(featureConfig)) { if (cmProp value = this->GetProperty(featureConfig)) {
return value->c_str(); return value;
} }
} }
if (cmProp value = this->GetProperty(feature)) { if (cmProp value = this->GetProperty(feature)) {
return value->c_str(); return value;
} }
return this->LocalGenerator->GetFeature(feature, config); return this->LocalGenerator->GetFeature(feature, config);
} }
@@ -853,8 +853,8 @@ const char* cmGeneratorTarget::GetLinkPIEProperty(
bool cmGeneratorTarget::IsIPOEnabled(std::string const& lang, bool cmGeneratorTarget::IsIPOEnabled(std::string const& lang,
std::string const& config) const std::string const& config) const
{ {
const char* feature = "INTERPROCEDURAL_OPTIMIZATION"; cmProp feature = this->GetFeature("INTERPROCEDURAL_OPTIMIZATION", config);
const bool result = cmIsOn(this->GetFeature(feature, config)); const bool result = feature && cmIsOn(*feature);
if (!result) { if (!result) {
// 'INTERPROCEDURAL_OPTIMIZATION' is off, no need to check policies // 'INTERPROCEDURAL_OPTIMIZATION' is off, no need to check policies
+2 -2
View File
@@ -175,8 +175,8 @@ public:
void ComputeObjectMapping(); void ComputeObjectMapping();
const char* GetFeature(const std::string& feature, cmProp GetFeature(const std::string& feature,
const std::string& config) const; const std::string& config) const;
const char* GetLinkPIEProperty(const std::string& config) const; const char* GetLinkPIEProperty(const std::string& config) const;
+2 -3
View File
@@ -694,9 +694,8 @@ std::set<std::string> cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
} }
// inspect EXCLUDE_FROM_DEFAULT_BUILD[_<CONFIG>] properties // inspect EXCLUDE_FROM_DEFAULT_BUILD[_<CONFIG>] properties
for (std::string const& i : configs) { for (std::string const& i : configs) {
const char* propertyValue = cmProp propertyValue = target->GetFeature("EXCLUDE_FROM_DEFAULT_BUILD", i);
target->GetFeature("EXCLUDE_FROM_DEFAULT_BUILD", i); if (!propertyValue || cmIsOff(*propertyValue)) {
if (cmIsOff(propertyValue)) {
activeConfigs.insert(i); activeConfigs.insert(i);
} }
} }
+3 -3
View File
@@ -3253,8 +3253,8 @@ void cmLocalGenerator::AppendFeatureOptions(std::string& flags,
} }
} }
const char* cmLocalGenerator::GetFeature(const std::string& feature, cmProp cmLocalGenerator::GetFeature(const std::string& feature,
const std::string& config) const std::string& config)
{ {
std::string featureName = feature; std::string featureName = feature;
// TODO: Define accumulation policy for features (prepend, append, // TODO: Define accumulation policy for features (prepend, append,
@@ -3266,7 +3266,7 @@ const char* cmLocalGenerator::GetFeature(const std::string& feature,
cmStateSnapshot snp = this->StateSnapshot; cmStateSnapshot snp = this->StateSnapshot;
while (snp.IsValid()) { while (snp.IsValid()) {
if (cmProp value = snp.GetDirectory().GetProperty(featureName)) { if (cmProp value = snp.GetDirectory().GetProperty(featureName)) {
return value->c_str(); return value;
} }
snp = snp.GetBuildsystemDirectoryParent(); snp = snp.GetBuildsystemDirectoryParent();
} }
+2 -2
View File
@@ -20,6 +20,7 @@
#include "cmMessageType.h" #include "cmMessageType.h"
#include "cmOutputConverter.h" #include "cmOutputConverter.h"
#include "cmPolicies.h" #include "cmPolicies.h"
#include "cmProperty.h"
#include "cmStateSnapshot.h" #include "cmStateSnapshot.h"
class cmComputeLinkInformation; class cmComputeLinkInformation;
@@ -209,8 +210,7 @@ public:
void AppendFeatureOptions(std::string& flags, const std::string& lang, void AppendFeatureOptions(std::string& flags, const std::string& lang,
const char* feature); const char* feature);
const char* GetFeature(const std::string& feature, cmProp GetFeature(const std::string& feature, const std::string& config);
const std::string& config);
/** \brief Get absolute path to dependency \a name /** \brief Get absolute path to dependency \a name
* *