summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-06-30 17:23:49 (GMT)
committerBrad King <brad.king@kitware.com>2014-07-07 12:52:42 (GMT)
commit93790506f52cb4e420be6a1a6988613380ecb1bc (patch)
tree873c637de69ee4a256cfe68ea584bb73a697a6e1
parentb5b098ebb39c97f3420eb7c24f0d4d5bc2d15a5a (diff)
downloadCMake-93790506f52cb4e420be6a1a6988613380ecb1bc.zip
CMake-93790506f52cb4e420be6a1a6988613380ecb1bc.tar.gz
CMake-93790506f52cb4e420be6a1a6988613380ecb1bc.tar.bz2
cmTarget: Simplify INTERFACE_INCLUDE_DIRECTORIES usage requirement lookup
Use the AddInterfaceEntries helper to avoid duplication. In TargetPropertyEntry, replace the TargetName string member with a reference to the full cmLinkImplItem that produced the entry. This is possible because the cmLinkImplItem is available in AddInterfaceEntries (it was not available in GetIncludeDirectories). Having the full cmLinkImplItem allows processIncludeDirectories to implement CMP0027 OLD behavior without repeating the target name lookup. Update the RunCMake.CompatibleInterface test DebugProperties case expected output for the new order of the messages.
-rw-r--r--Source/cmTarget.cxx76
-rw-r--r--Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt14
2 files changed, 22 insertions, 68 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 0c96c91..0a7724c 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -165,14 +165,16 @@ public:
std::set<cmLinkItem> UtilityItems;
bool UtilityItemsDone;
- struct TargetPropertyEntry {
+ class TargetPropertyEntry {
+ static cmLinkImplItem NoLinkImplItem;
+ public:
TargetPropertyEntry(cmsys::auto_ptr<cmCompiledGeneratorExpression> cge,
- const std::string &targetName = std::string())
- : ge(cge), TargetName(targetName)
+ cmLinkImplItem const& item = NoLinkImplItem)
+ : ge(cge), LinkImplItem(item)
{}
const cmsys::auto_ptr<cmCompiledGeneratorExpression> ge;
std::vector<std::string> CachedEntries;
- const std::string TargetName;
+ cmLinkImplItem const& LinkImplItem;
};
std::vector<TargetPropertyEntry*> IncludeDirectoriesEntries;
std::vector<TargetPropertyEntry*> CompileOptionsEntries;
@@ -206,6 +208,8 @@ public:
std::map<std::string, bool> CacheLinkImplementationClosureDone;
};
+cmLinkImplItem cmTargetInternals::TargetPropertyEntry::NoLinkImplItem;
+
//----------------------------------------------------------------------------
void deleteAndClear(
std::vector<cmTargetInternals::TargetPropertyEntry*> &entries)
@@ -2012,24 +2016,10 @@ static void processIncludeDirectories(cmTarget const* tgt,
for (std::vector<cmTargetInternals::TargetPropertyEntry*>::const_iterator
it = entries.begin(), end = entries.end(); it != end; ++it)
{
- std::string targetName = (*it)->TargetName;
- bool checkCMP0027 = false;
- if(!cmGeneratorExpression::IsValidTargetName(targetName)
- && cmGeneratorExpression::Find(targetName) != std::string::npos)
- {
- std::string evaluatedTargetName;
- cmGeneratorExpression ge;
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
- ge.Parse(targetName);
- evaluatedTargetName = cge->Evaluate(mf, config, false, tgt, 0, 0);
- checkCMP0027 = evaluatedTargetName != targetName;
- targetName = evaluatedTargetName;
- }
- cmTarget *dependentTarget = mf->FindTargetToUse(targetName);
-
- const bool fromImported =
- dependentTarget && dependentTarget->IsImported();
-
+ cmLinkImplItem const& item = (*it)->LinkImplItem;
+ std::string const& targetName = item;
+ bool const fromImported = item.Target && item.Target->IsImported();
+ bool const checkCMP0027 = item.FromGenex;
bool testIsOff = true;
bool cacheIncludes = false;
std::vector<std::string>& entryIncludes = (*it)->CachedEntries;
@@ -2200,45 +2190,9 @@ cmTarget::GetIncludeDirectories(const std::string& config) const
if (!this->Internal->CacheLinkInterfaceIncludeDirectoriesDone[config])
{
- for (std::vector<cmValueWithOrigin>::const_iterator
- it = this->Internal->LinkImplementationPropertyEntries.begin(),
- end = this->Internal->LinkImplementationPropertyEntries.end();
- it != end; ++it)
- {
- if (!cmGeneratorExpression::IsValidTargetName(it->Value)
- && cmGeneratorExpression::Find(it->Value) == std::string::npos)
- {
- continue;
- }
- {
- cmGeneratorExpression ge;
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
- ge.Parse(it->Value);
- std::string result = cge->Evaluate(this->Makefile, config,
- false, this, 0, 0);
- if (!this->Makefile->FindTargetToUse(result))
- {
- continue;
- }
- }
- std::string includeGenex = "$<TARGET_PROPERTY:" +
- it->Value + ",INTERFACE_INCLUDE_DIRECTORIES>";
- if (cmGeneratorExpression::Find(it->Value) != std::string::npos)
- {
- // Because it->Value is a generator expression, ensure that it
- // evaluates to the non-empty string before being used in the
- // TARGET_PROPERTY expression.
- includeGenex = "$<$<BOOL:" + it->Value + ">:" + includeGenex + ">";
- }
- cmGeneratorExpression ge(&it->Backtrace);
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(
- includeGenex);
-
- this->Internal
- ->CachedLinkInterfaceIncludeDirectoriesEntries[config].push_back(
- new cmTargetInternals::TargetPropertyEntry(cge,
- it->Value));
- }
+ this->Internal->AddInterfaceEntries(
+ this, config, "INTERFACE_INCLUDE_DIRECTORIES",
+ this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries[config]);
if(this->Makefile->IsOn("APPLE"))
{
diff --git a/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt b/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt
index 82a34d5..17b8a5c 100644
--- a/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt
+++ b/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt
@@ -1,11 +1,4 @@
CMake Debug Log:
- Boolean compatibility of property "BOOL_PROP7" for target
- "CompatibleInterface" \(result: "FALSE"\):
-
- \* Target "CompatibleInterface" property is implied by use.
- \* Target "iface1" property value "FALSE" \(Agree\)
-+
-CMake Debug Log:
Boolean compatibility of property "BOOL_PROP1" for target
"CompatibleInterface" \(result: "TRUE"\):
@@ -47,6 +40,13 @@ CMake Debug Log:
\* Target "iface2" property value "FALSE" \(Agree\)
+
CMake Debug Log:
+ Boolean compatibility of property "BOOL_PROP7" for target
+ "CompatibleInterface" \(result: "FALSE"\):
+
+ \* Target "CompatibleInterface" property is implied by use.
+ \* Target "iface1" property value "FALSE" \(Agree\)
++
+CMake Debug Log:
String compatibility of property "STRING_PROP1" for target
"CompatibleInterface" \(result: "prop1"\):