summaryrefslogtreecommitdiffstats
path: root/Source/cmTarget.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-03-24 20:18:21 (GMT)
committerBrad King <brad.king@kitware.com>2013-03-26 14:45:28 (GMT)
commit28051f1150923804796b4e63e41f6906308788e0 (patch)
treea6892197cd2aba0b1910b2d9ee022cf094da2f24 /Source/cmTarget.cxx
parentaf81a3c31b206633742eb13d41c54a9bc807ffea (diff)
downloadCMake-28051f1150923804796b4e63e41f6906308788e0.zip
CMake-28051f1150923804796b4e63e41f6906308788e0.tar.gz
CMake-28051f1150923804796b4e63e41f6906308788e0.tar.bz2
Report an error on IMPORTED targets with a faulty INTERFACE
It is considered an error if the INTERFACE_INCLUDE_DIRECTORIES contains a directory which does not exist, which indicates a programmer error by the upstream, or a packaging error. One of the RunCMake.CompatibleInterface tests also needs to be updated due to this change. Non-existant includes were used in the test, but are not needed.
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r--Source/cmTarget.cxx31
1 files changed, 28 insertions, 3 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 61d4ce2..b4fdcd5 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -131,11 +131,13 @@ public:
SourceEntriesType SourceEntries;
struct IncludeDirectoriesEntry {
- IncludeDirectoriesEntry(cmsys::auto_ptr<cmCompiledGeneratorExpression> cge)
- : ge(cge)
+ IncludeDirectoriesEntry(cmsys::auto_ptr<cmCompiledGeneratorExpression> cge,
+ const std::string &targetName = std::string())
+ : ge(cge), TargetName(targetName)
{}
const cmsys::auto_ptr<cmCompiledGeneratorExpression> ge;
std::vector<std::string> CachedIncludes;
+ const std::string TargetName;
};
std::vector<IncludeDirectoriesEntry*> IncludeDirectoriesEntries;
std::vector<cmValueWithOrigin> LinkInterfaceIncludeDirectoriesEntries;
@@ -2818,6 +2820,28 @@ static void processIncludeDirectories(cmTarget *tgt,
for(std::vector<std::string>::iterator
li = entryIncludes.begin(); li != entryIncludes.end(); ++li)
{
+ cmTarget *dependentTarget =
+ mf->FindTargetToUse((*it)->TargetName.c_str());
+
+ const bool fromImported = dependentTarget
+ && dependentTarget->IsImported();
+
+ if (fromImported && !cmSystemTools::FileExists(li->c_str()))
+ {
+ cmOStringStream e;
+ e << "Imported target \"" << (*it)->TargetName << "\" includes "
+ "non-existent path\n \"" << *li << "\"\nin its "
+ "INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:\n"
+ "* The path was deleted, renamed, or moved to another "
+ "location.\n"
+ "* An install or uninstall procedure did not complete "
+ "successfully.\n"
+ "* The installation package was faulty and references files it "
+ "does not provide.\n";
+ tgt->GetMakefile()->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
+ return;
+ }
+
if (testIsOff && !cmSystemTools::IsOff(li->c_str()))
{
cmSystemTools::ConvertToUnixSlashes(*li);
@@ -2913,7 +2937,8 @@ std::vector<std::string> cmTarget::GetIncludeDirectories(const char *config)
it->Value + ",INTERFACE_INCLUDE_DIRECTORIES>");
this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries.push_back(
- new cmTargetInternals::IncludeDirectoriesEntry(cge));
+ new cmTargetInternals::IncludeDirectoriesEntry(cge,
+ it->Value));
}
}