summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-07-14 11:19:25 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-07-14 11:20:15 (GMT)
commit35928fa7ca4c2b4cc39c4cf6aaa2059ebb3b86ce (patch)
tree34d49dde5bc444c7d3e9f999ba91328dfb660ba0
parent2455ec9565a570557ba1cf1417d27e6bdcb65614 (diff)
parent18726ad634d0f182940d45e9f569000cebcc4377 (diff)
downloadCMake-35928fa7ca4c2b4cc39c4cf6aaa2059ebb3b86ce.zip
CMake-35928fa7ca4c2b4cc39c4cf6aaa2059ebb3b86ce.tar.gz
CMake-35928fa7ca4c2b4cc39c4cf6aaa2059ebb3b86ce.tar.bz2
Merge topic 'getfeature-prop'
18726ad634 GetFeature(): return cmProp Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5004
-rw-r--r--Source/cmCommonTargetGenerator.cxx2
-rw-r--r--Source/cmGeneratorTarget.cxx12
-rw-r--r--Source/cmGeneratorTarget.h4
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx5
-rw-r--r--Source/cmLocalGenerator.cxx6
-rw-r--r--Source/cmLocalGenerator.h4
6 files changed, 16 insertions, 17 deletions
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index 051eff6..8aee27c 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -41,7 +41,7 @@ std::vector<std::string> const& cmCommonTargetGenerator::GetConfigNames() const
const char* cmCommonTargetGenerator::GetFeature(const std::string& feature,
const std::string& config)
{
- return this->GeneratorTarget->GetFeature(feature, config);
+ return this->GeneratorTarget->GetFeature(feature, config)->c_str();
}
void cmCommonTargetGenerator::AddModuleDefinitionFlag(
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index b202e91..9e6f995 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -815,18 +815,18 @@ void cmGeneratorTarget::ComputeObjectMapping()
}
}
-const char* cmGeneratorTarget::GetFeature(const std::string& feature,
- const std::string& config) const
+cmProp cmGeneratorTarget::GetFeature(const std::string& feature,
+ const std::string& config) const
{
if (!config.empty()) {
std::string featureConfig =
cmStrCat(feature, '_', cmSystemTools::UpperCase(config));
if (cmProp value = this->GetProperty(featureConfig)) {
- return value->c_str();
+ return value;
}
}
if (cmProp value = this->GetProperty(feature)) {
- return value->c_str();
+ return value;
}
return this->LocalGenerator->GetFeature(feature, config);
}
@@ -853,8 +853,8 @@ const char* cmGeneratorTarget::GetLinkPIEProperty(
bool cmGeneratorTarget::IsIPOEnabled(std::string const& lang,
std::string const& config) const
{
- const char* feature = "INTERPROCEDURAL_OPTIMIZATION";
- const bool result = cmIsOn(this->GetFeature(feature, config));
+ cmProp feature = this->GetFeature("INTERPROCEDURAL_OPTIMIZATION", config);
+ const bool result = feature && cmIsOn(*feature);
if (!result) {
// 'INTERPROCEDURAL_OPTIMIZATION' is off, no need to check policies
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 07f071b..08aa015 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -175,8 +175,8 @@ public:
void ComputeObjectMapping();
- const char* GetFeature(const std::string& feature,
- const std::string& config) const;
+ cmProp GetFeature(const std::string& feature,
+ const std::string& config) const;
const char* GetLinkPIEProperty(const std::string& config) const;
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 9f798e6..1d3bf20 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -694,9 +694,8 @@ std::set<std::string> cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
}
// inspect EXCLUDE_FROM_DEFAULT_BUILD[_<CONFIG>] properties
for (std::string const& i : configs) {
- const char* propertyValue =
- target->GetFeature("EXCLUDE_FROM_DEFAULT_BUILD", i);
- if (cmIsOff(propertyValue)) {
+ cmProp propertyValue = target->GetFeature("EXCLUDE_FROM_DEFAULT_BUILD", i);
+ if (!propertyValue || cmIsOff(*propertyValue)) {
activeConfigs.insert(i);
}
}
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 489065b..e7f2e64 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -3253,8 +3253,8 @@ void cmLocalGenerator::AppendFeatureOptions(std::string& flags,
}
}
-const char* cmLocalGenerator::GetFeature(const std::string& feature,
- const std::string& config)
+cmProp cmLocalGenerator::GetFeature(const std::string& feature,
+ const std::string& config)
{
std::string featureName = feature;
// TODO: Define accumulation policy for features (prepend, append,
@@ -3266,7 +3266,7 @@ const char* cmLocalGenerator::GetFeature(const std::string& feature,
cmStateSnapshot snp = this->StateSnapshot;
while (snp.IsValid()) {
if (cmProp value = snp.GetDirectory().GetProperty(featureName)) {
- return value->c_str();
+ return value;
}
snp = snp.GetBuildsystemDirectoryParent();
}
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index f4781d6..0c51a65 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -20,6 +20,7 @@
#include "cmMessageType.h"
#include "cmOutputConverter.h"
#include "cmPolicies.h"
+#include "cmProperty.h"
#include "cmStateSnapshot.h"
class cmComputeLinkInformation;
@@ -209,8 +210,7 @@ public:
void AppendFeatureOptions(std::string& flags, const std::string& lang,
const char* feature);
- const char* GetFeature(const std::string& feature,
- const std::string& config);
+ cmProp GetFeature(const std::string& feature, const std::string& config);
/** \brief Get absolute path to dependency \a name
*