summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-10-25 09:35:36 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-10-27 06:44:23 (GMT)
commit520ca0ff6c123250c633a3618459d0161cbc4683 (patch)
treed1d77c41acba19eb91e4a8e6ef359243a438324f
parent3e3c754b8cc3af463dcea95000daf3a18b359b7a (diff)
downloadCMake-520ca0ff6c123250c633a3618459d0161cbc4683.zip
CMake-520ca0ff6c123250c633a3618459d0161cbc4683.tar.gz
CMake-520ca0ff6c123250c633a3618459d0161cbc4683.tar.bz2
cmGeneratorTarget: Add API for property keys
-rw-r--r--Source/cmExportTryCompileFileGenerator.cxx16
-rw-r--r--Source/cmGeneratorTarget.cxx29
-rw-r--r--Source/cmGeneratorTarget.h1
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx10
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx11
5 files changed, 44 insertions, 23 deletions
diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx
index 1daa67e..83127e7 100644
--- a/Source/cmExportTryCompileFileGenerator.cxx
+++ b/Source/cmExportTryCompileFileGenerator.cxx
@@ -105,16 +105,18 @@ cmExportTryCompileFileGenerator::PopulateProperties(
ImportPropertyMap& properties,
std::set<cmGeneratorTarget const*> &emitted)
{
- cmPropertyMap props = target->Target->GetProperties();
- for(cmPropertyMap::const_iterator i = props.begin(); i != props.end(); ++i)
+ std::vector<std::string> props = target->GetPropertyKeys();
+ for(std::vector<std::string>::const_iterator i = props.begin();
+ i != props.end(); ++i)
{
- properties[i->first] = i->second.GetValue();
- if(i->first.find("IMPORTED_LINK_INTERFACE_LIBRARIES") == 0
- || i->first.find("IMPORTED_LINK_DEPENDENT_LIBRARIES") == 0
- || i->first.find("INTERFACE_LINK_LIBRARIES") == 0)
+ properties[*i] = target->GetProperty(*i);
+
+ if(i->find("IMPORTED_LINK_INTERFACE_LIBRARIES") == 0
+ || i->find("IMPORTED_LINK_DEPENDENT_LIBRARIES") == 0
+ || i->find("INTERFACE_LINK_LIBRARIES") == 0)
{
- std::string evalResult = this->FindTargets(i->first,
+ std::string evalResult = this->FindTargets(*i,
target, emitted);
std::vector<std::string> depends;
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 651c89c..3df43ff 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -4251,9 +4251,11 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt,
PropertyType *)
{
PropertyType propContent = getTypedProperty<PropertyType>(tgt, p);
- const bool explicitlySet = tgt->Target->GetProperties()
- .find(p)
- != tgt->Target->GetProperties().end();
+ std::vector<std::string> headPropKeys = tgt->GetPropertyKeys();
+ const bool explicitlySet =
+ std::find(headPropKeys.begin(), headPropKeys.end(),
+ p) != headPropKeys.end();
+
const bool impliedByUse =
tgt->IsNullImpliedByLinkLibraries(p);
assert((impliedByUse ^ explicitlySet)
@@ -4298,9 +4300,11 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt,
cmGeneratorTarget const* theTarget = *li;
- const bool ifaceIsSet = theTarget->Target->GetProperties()
- .find(interfaceProperty)
- != theTarget->Target->GetProperties().end();
+ std::vector<std::string> propKeys = theTarget->GetPropertyKeys();
+
+ const bool ifaceIsSet =
+ std::find(propKeys.begin(), propKeys.end(),
+ interfaceProperty) != propKeys.end();
PropertyType ifacePropContent =
getTypedProperty<PropertyType>(theTarget,
interfaceProperty);
@@ -4577,6 +4581,19 @@ void cmGeneratorTarget::ComputeVersionedName(std::string& vName,
vName += this->Makefile->IsOn("APPLE") ? suffix : std::string();
}
+std::vector<std::string> cmGeneratorTarget::GetPropertyKeys() const
+{
+ cmPropertyMap propsObject = this->Target->GetProperties();
+ std::vector<std::string> props;
+ props.reserve(propsObject.size());
+ for (cmPropertyMap::const_iterator it = propsObject.begin();
+ it != propsObject.end(); ++it)
+ {
+ props.push_back(it->first);
+ }
+ return props;
+}
+
//----------------------------------------------------------------------------
void
cmGeneratorTarget::ReportPropertyOrigin(const std::string &p,
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 58c3421..3c6f267 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -57,6 +57,7 @@ public:
std::string GetName() const;
std::string GetExportName() const;
+ std::vector<std::string> GetPropertyKeys() const;
const char *GetProperty(const std::string& prop) const;
bool GetPropertyAsBool(const std::string& prop) const;
void GetSourceFiles(std::vector<cmSourceFile*>& files,
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 5737bee..42f9758 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -2486,13 +2486,13 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
// put this last so it can override existing settings
// Convert "XCODE_ATTRIBUTE_*" properties directly.
{
- cmPropertyMap const& props = gtgt->Target->GetProperties();
- for(cmPropertyMap::const_iterator i = props.begin();
+ std::vector<std::string> const& props = gtgt->GetPropertyKeys();
+ for(std::vector<std::string>::const_iterator i = props.begin();
i != props.end(); ++i)
{
- if(i->first.find("XCODE_ATTRIBUTE_") == 0)
+ if(i->find("XCODE_ATTRIBUTE_") == 0)
{
- std::string attribute = i->first.substr(16);
+ std::string attribute = i->substr(16);
// Handle [variant=<config>] condition explicitly here.
std::string::size_type beginVariant =
attribute.find("[variant=");
@@ -2523,7 +2523,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
if (!attribute.empty())
{
cmGeneratorExpression ge;
- std::string processed = ge.Parse(i->second.GetValue())
+ std::string processed = ge.Parse(gtgt->GetProperty(*i))
->Evaluate(this->CurrentLocalGenerator, configName);
buildSettings->AddAttribute(attribute.c_str(),
this->CreateString(processed));
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 0eac203..ae6a24e 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -2219,17 +2219,18 @@ void cmLocalVisualStudio7Generator::WriteVCProjFooter(
{
fout << "\t<Globals>\n";
- cmPropertyMap const& props = target->Target->GetProperties();
- for(cmPropertyMap::const_iterator i = props.begin(); i != props.end(); ++i)
+ std::vector<std::string> const& props = target->GetPropertyKeys();
+ for(std::vector<std::string>::const_iterator i = props.begin();
+ i != props.end(); ++i)
{
- if(i->first.find("VS_GLOBAL_") == 0)
+ if(i->find("VS_GLOBAL_") == 0)
{
- std::string name = i->first.substr(10);
+ std::string name = i->substr(10);
if(name != "")
{
fout << "\t\t<Global\n"
<< "\t\t\tName=\"" << name << "\"\n"
- << "\t\t\tValue=\"" << i->second.GetValue() << "\"\n"
+ << "\t\t\tValue=\"" << target->GetProperty(*i) << "\"\n"
<< "\t\t/>\n";
}
}