summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-05-06 14:09:28 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2013-05-06 14:09:28 (GMT)
commit0483bf8062822b56158740e5cbe897b728d9809c (patch)
tree957afa8865917698808dc91361e54649b1657f79 /Source
parentb85f691d78b4f37f05304e95e853b6c01f01bd25 (diff)
parentdea1df4e5e05b8ba3de5099741a50cdea384f88e (diff)
downloadCMake-0483bf8062822b56158740e5cbe897b728d9809c.zip
CMake-0483bf8062822b56158740e5cbe897b728d9809c.tar.gz
CMake-0483bf8062822b56158740e5cbe897b728d9809c.tar.bz2
Merge topic 'fix-per-config-tll-include-dirs'
dea1df4 Memoize usage requirement include directories in a config-specific map 26dba6a Fix include dir propagation from conditionally linked targets b8259c3 Centralize maintenance of usage requirement include directories
Diffstat (limited to 'Source')
-rw-r--r--Source/cmTarget.cxx68
-rw-r--r--Source/cmTarget.h1
-rw-r--r--Source/cmTargetLinkLibrariesCommand.cxx8
3 files changed, 54 insertions, 23 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 66c22b1..d14bfca 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -142,7 +142,7 @@ public:
std::vector<IncludeDirectoriesEntry*> IncludeDirectoriesEntries;
std::vector<cmValueWithOrigin> LinkInterfaceIncludeDirectoriesEntries;
- std::vector<IncludeDirectoriesEntry*>
+ std::map<std::string, std::vector<IncludeDirectoriesEntry*> >
CachedLinkInterfaceIncludeDirectoriesEntries;
std::map<std::string, std::string> CachedLinkInterfaceCompileDefinitions;
@@ -165,6 +165,19 @@ void deleteAndClear(
}
//----------------------------------------------------------------------------
+void deleteAndClear(
+ std::map<std::string,
+ std::vector<cmTargetInternals::IncludeDirectoriesEntry*> > &entries)
+{
+ for (std::map<std::string,
+ std::vector<cmTargetInternals::IncludeDirectoriesEntry*> >::iterator
+ it = entries.begin(), end = entries.end(); it != end; ++it)
+ {
+ deleteAndClear(it->second);
+ }
+}
+
+//----------------------------------------------------------------------------
cmTargetInternals::~cmTargetInternals()
{
deleteAndClear(CachedLinkInterfaceIncludeDirectoriesEntries);
@@ -2706,6 +2719,19 @@ void cmTarget::SetProperty(const char* prop, const char* value)
new cmTargetInternals::IncludeDirectoriesEntry(cge));
return;
}
+ if (strcmp(prop, "LINK_LIBRARIES") == 0)
+ {
+ this->Internal->LinkInterfaceIncludeDirectoriesEntries.clear();
+ if (cmGeneratorExpression::IsValidTargetName(value)
+ || cmGeneratorExpression::Find(value) != std::string::npos)
+ {
+ cmListFileBacktrace lfbt;
+ this->Makefile->GetBacktrace(lfbt);
+ cmValueWithOrigin entry(value, lfbt);
+ this->Internal->LinkInterfaceIncludeDirectoriesEntries.push_back(entry);
+ }
+ // Fall through
+ }
this->Properties.SetProperty(prop, value, cmProperty::TARGET);
this->MaybeInvalidatePropertyCache(prop);
}
@@ -2727,6 +2753,18 @@ void cmTarget::AppendProperty(const char* prop, const char* value,
new cmTargetInternals::IncludeDirectoriesEntry(ge.Parse(value)));
return;
}
+ if (strcmp(prop, "LINK_LIBRARIES") == 0)
+ {
+ if (cmGeneratorExpression::IsValidTargetName(value)
+ || cmGeneratorExpression::Find(value) != std::string::npos)
+ {
+ cmListFileBacktrace lfbt;
+ this->Makefile->GetBacktrace(lfbt);
+ cmValueWithOrigin entry(value, lfbt);
+ this->Internal->LinkInterfaceIncludeDirectoriesEntries.push_back(entry);
+ }
+ // Fall through
+ }
this->Properties.AppendProperty(prop, value, cmProperty::TARGET, asString);
this->MaybeInvalidatePropertyCache(prop);
}
@@ -2763,12 +2801,6 @@ void cmTarget::AppendBuildInterfaceIncludes()
}
//----------------------------------------------------------------------------
-void cmTarget::AppendTllInclude(const cmValueWithOrigin &entry)
-{
- this->Internal->LinkInterfaceIncludeDirectoriesEntries.push_back(entry);
-}
-
-//----------------------------------------------------------------------------
void cmTarget::InsertInclude(const cmValueWithOrigin &entry,
bool before)
{
@@ -2939,25 +2971,33 @@ std::vector<std::string> cmTarget::GetIncludeDirectories(const char *config)
ge.Parse(it->Value);
std::string result = cge->Evaluate(this->Makefile, config,
false, this, 0, 0);
- if (!cmGeneratorExpression::IsValidTargetName(result.c_str())
- || !this->Makefile->FindTargetToUse(result.c_str()))
+ if (!this->Makefile->FindTargetToUse(result.c_str()))
{
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(
- "$<TARGET_PROPERTY:" +
- it->Value + ",INTERFACE_INCLUDE_DIRECTORIES>");
+ includeGenex);
- this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries.push_back(
+ this->Internal
+ ->CachedLinkInterfaceIncludeDirectoriesEntries[configString].push_back(
new cmTargetInternals::IncludeDirectoriesEntry(cge,
it->Value));
}
}
processIncludeDirectories(this,
- this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries,
+ this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries[configString],
includes,
uniqueIncludes,
&dagChecker,
@@ -2967,7 +3007,7 @@ std::vector<std::string> cmTarget::GetIncludeDirectories(const char *config)
if (!this->Makefile->IsGeneratingBuildSystem())
{
deleteAndClear(
- this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries);
+ this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries);
}
else
{
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index e25133e..9d46796 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -495,7 +495,6 @@ public:
std::vector<std::string> GetIncludeDirectories(const char *config);
void InsertInclude(const cmValueWithOrigin &entry,
bool before = false);
- void AppendTllInclude(const cmValueWithOrigin &entry);
void AppendBuildInterfaceIncludes();
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index 3f652c9..b7b7691 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -259,14 +259,6 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const char* lib,
// Handle normal case first.
if(this->CurrentProcessingState != ProcessingLinkInterface)
{
- {
- cmListFileBacktrace lfbt;
- this->Makefile->GetBacktrace(lfbt);
- cmValueWithOrigin entry(this->Target->GetDebugGeneratorExpressions(lib,
- llt),
- lfbt);
- this->Target->AppendTllInclude(entry);
- }
this->Makefile
->AddLinkLibraryForTarget(this->Target->GetName(), lib, llt);
if (this->CurrentProcessingState != ProcessingPublicInterface)