diff options
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r-- | Source/cmTarget.cxx | 51 |
1 files changed, 44 insertions, 7 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 5e10e25..b6182ab 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1911,19 +1911,56 @@ static void processIncludeDirectories(cmTarget *tgt, } } std::string usedIncludes; + cmListFileBacktrace lfbt; for(std::vector<std::string>::iterator li = entryIncludes.begin(); li != entryIncludes.end(); ++li) { - cmTarget *dependentTarget = - mf->FindTargetToUse((*it)->TargetName.c_str()); + std::string targetName = (*it)->TargetName; + std::string evaluatedTargetName; + { + cmGeneratorExpression ge(lfbt); + cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = + ge.Parse(targetName); + evaluatedTargetName = cge->Evaluate(mf, config, false, tgt, 0, 0); + } + + cmTarget *dependentTarget = mf->FindTargetToUse(targetName.c_str()); const bool fromImported = dependentTarget && dependentTarget->IsImported(); - if (fromImported && !cmSystemTools::FileExists(li->c_str())) + cmTarget *evaluatedDependentTarget = + (targetName != evaluatedTargetName) + ? mf->FindTargetToUse(evaluatedTargetName.c_str()) + : 0; + + targetName = evaluatedTargetName; + + const bool fromEvaluatedImported = evaluatedDependentTarget + && evaluatedDependentTarget->IsImported(); + + if ((fromImported || fromEvaluatedImported) + && !cmSystemTools::FileExists(li->c_str())) { cmOStringStream e; - e << "Imported target \"" << (*it)->TargetName << "\" includes " + cmake::MessageType messageType = cmake::FATAL_ERROR; + if (fromEvaluatedImported) + { + switch(mf->GetPolicyStatus(cmPolicies::CMP0027)) + { + case cmPolicies::WARN: + e << (mf->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0027)) << "\n"; + case cmPolicies::OLD: + messageType = cmake::AUTHOR_WARNING; + break; + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::NEW: + break; + } + } + e << "Imported target \"" << 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 " @@ -1932,7 +1969,7 @@ static void processIncludeDirectories(cmTarget *tgt, "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()); + tgt->GetMakefile()->IssueMessage(messageType, e.str().c_str()); return; } @@ -1941,9 +1978,9 @@ static void processIncludeDirectories(cmTarget *tgt, cmOStringStream e; bool noMessage = false; cmake::MessageType messageType = cmake::FATAL_ERROR; - if (!(*it)->TargetName.empty()) + if (!targetName.empty()) { - e << "Target \"" << (*it)->TargetName << "\" contains relative " + e << "Target \"" << targetName << "\" contains relative " "path in its INTERFACE_INCLUDE_DIRECTORIES:\n" " \"" << *li << "\""; } |