Skip to content

Commit 35928fa

Browse files
bradkingkwrobot
authored andcommitted
Merge topic 'getfeature-prop'
18726ad GetFeature(): return cmProp Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5004
2 parents 2455ec9 + 18726ad commit 35928fa

File tree

6 files changed

+16
-17
lines changed

6 files changed

+16
-17
lines changed

Source/cmCommonTargetGenerator.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ std::vector<std::string> const& cmCommonTargetGenerator::GetConfigNames() const
4141
const char* cmCommonTargetGenerator::GetFeature(const std::string& feature,
4242
const std::string& config)
4343
{
44-
return this->GeneratorTarget->GetFeature(feature, config);
44+
return this->GeneratorTarget->GetFeature(feature, config)->c_str();
4545
}
4646

4747
void cmCommonTargetGenerator::AddModuleDefinitionFlag(

Source/cmGeneratorTarget.cxx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -815,18 +815,18 @@ void cmGeneratorTarget::ComputeObjectMapping()
815815
}
816816
}
817817

818-
const char* cmGeneratorTarget::GetFeature(const std::string& feature,
819-
const std::string& config) const
818+
cmProp cmGeneratorTarget::GetFeature(const std::string& feature,
819+
const std::string& config) const
820820
{
821821
if (!config.empty()) {
822822
std::string featureConfig =
823823
cmStrCat(feature, '_', cmSystemTools::UpperCase(config));
824824
if (cmProp value = this->GetProperty(featureConfig)) {
825-
return value->c_str();
825+
return value;
826826
}
827827
}
828828
if (cmProp value = this->GetProperty(feature)) {
829-
return value->c_str();
829+
return value;
830830
}
831831
return this->LocalGenerator->GetFeature(feature, config);
832832
}
@@ -853,8 +853,8 @@ const char* cmGeneratorTarget::GetLinkPIEProperty(
853853
bool cmGeneratorTarget::IsIPOEnabled(std::string const& lang,
854854
std::string const& config) const
855855
{
856-
const char* feature = "INTERPROCEDURAL_OPTIMIZATION";
857-
const bool result = cmIsOn(this->GetFeature(feature, config));
856+
cmProp feature = this->GetFeature("INTERPROCEDURAL_OPTIMIZATION", config);
857+
const bool result = feature && cmIsOn(*feature);
858858

859859
if (!result) {
860860
// 'INTERPROCEDURAL_OPTIMIZATION' is off, no need to check policies

Source/cmGeneratorTarget.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ class cmGeneratorTarget
175175

176176
void ComputeObjectMapping();
177177

178-
const char* GetFeature(const std::string& feature,
179-
const std::string& config) const;
178+
cmProp GetFeature(const std::string& feature,
179+
const std::string& config) const;
180180

181181
const char* GetLinkPIEProperty(const std::string& config) const;
182182

Source/cmGlobalVisualStudio7Generator.cxx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -694,9 +694,8 @@ std::set<std::string> cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
694694
}
695695
// inspect EXCLUDE_FROM_DEFAULT_BUILD[_<CONFIG>] properties
696696
for (std::string const& i : configs) {
697-
const char* propertyValue =
698-
target->GetFeature("EXCLUDE_FROM_DEFAULT_BUILD", i);
699-
if (cmIsOff(propertyValue)) {
697+
cmProp propertyValue = target->GetFeature("EXCLUDE_FROM_DEFAULT_BUILD", i);
698+
if (!propertyValue || cmIsOff(*propertyValue)) {
700699
activeConfigs.insert(i);
701700
}
702701
}

Source/cmLocalGenerator.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3253,8 +3253,8 @@ void cmLocalGenerator::AppendFeatureOptions(std::string& flags,
32533253
}
32543254
}
32553255

3256-
const char* cmLocalGenerator::GetFeature(const std::string& feature,
3257-
const std::string& config)
3256+
cmProp cmLocalGenerator::GetFeature(const std::string& feature,
3257+
const std::string& config)
32583258
{
32593259
std::string featureName = feature;
32603260
// TODO: Define accumulation policy for features (prepend, append,
@@ -3266,7 +3266,7 @@ const char* cmLocalGenerator::GetFeature(const std::string& feature,
32663266
cmStateSnapshot snp = this->StateSnapshot;
32673267
while (snp.IsValid()) {
32683268
if (cmProp value = snp.GetDirectory().GetProperty(featureName)) {
3269-
return value->c_str();
3269+
return value;
32703270
}
32713271
snp = snp.GetBuildsystemDirectoryParent();
32723272
}

Source/cmLocalGenerator.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "cmMessageType.h"
2121
#include "cmOutputConverter.h"
2222
#include "cmPolicies.h"
23+
#include "cmProperty.h"
2324
#include "cmStateSnapshot.h"
2425

2526
class cmComputeLinkInformation;
@@ -209,8 +210,7 @@ class cmLocalGenerator : public cmOutputConverter
209210
void AppendFeatureOptions(std::string& flags, const std::string& lang,
210211
const char* feature);
211212

212-
const char* GetFeature(const std::string& feature,
213-
const std::string& config);
213+
cmProp GetFeature(const std::string& feature, const std::string& config);
214214

215215
/** \brief Get absolute path to dependency \a name
216216
*

0 commit comments

Comments
 (0)