summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-10-18 14:43:41 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2013-10-18 14:43:41 (GMT)
commit919e1e845361d6e29789f5347d12af3318452843 (patch)
treecec185445680d3264355302f5bc380ab7181ce30 /Source
parent36d8d987c705dd693454f3157f7d8c0f50b9f0ff (diff)
parent70ae6dfd922e53e759ec6a58424dfdbb9c12dee1 (diff)
downloadCMake-919e1e845361d6e29789f5347d12af3318452843.zip
CMake-919e1e845361d6e29789f5347d12af3318452843.tar.gz
CMake-919e1e845361d6e29789f5347d12af3318452843.tar.bz2
Merge topic 'INTERFACE-error-with-linked-genex'
70ae6df Handle genexes when evaluating INTERFACE_INCLUDE_DIRECTORIES errors.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmPolicies.cxx5
-rw-r--r--Source/cmPolicies.h2
-rw-r--r--Source/cmTarget.cxx51
3 files changed, 51 insertions, 7 deletions
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 2ecdb42..ffab8e5 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -236,6 +236,11 @@ cmPolicies::cmPolicies()
CMP0026, "CMP0026",
"Disallow use of the LOCATION target property.",
3,0,0,0, cmPolicies::WARN);
+
+ this->DefinePolicy(
+ CMP0027, "CMP0027",
+ "Conditionally linked imported targets with missing include directories.",
+ 3,0,0,0, cmPolicies::WARN);
}
cmPolicies::~cmPolicies()
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 81a4d99..39c2afb 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -77,6 +77,8 @@ public:
CMP0024, ///< Disallow including export() result.
CMP0025, ///< Compiler id for Apple Clang is now AppleClang
CMP0026, ///< Disallow use of the LOCATION target property.
+ CMP0027, ///< Conditionally linked imported targets with missing include
+ /// directories.
/** \brief Always the last entry.
*
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 << "\"";
}