summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-04-16 19:53:57 (GMT)
committerBrad King <brad.king@kitware.com>2014-04-16 19:57:35 (GMT)
commit9e0b3153fa2fa9e1b51d1fd7d265a114958e7f0a (patch)
tree0388dcea30486be374912c4495d45e6d22401f2a
parentfd8bb3427858017754d5b08a2eb1f57116feebb6 (diff)
downloadCMake-9e0b3153fa2fa9e1b51d1fd7d265a114958e7f0a.zip
CMake-9e0b3153fa2fa9e1b51d1fd7d265a114958e7f0a.tar.gz
CMake-9e0b3153fa2fa9e1b51d1fd7d265a114958e7f0a.tar.bz2
CMP0052: Do not warn when include dir is not in source or build tree
When the policy was added by commit 783bce29 (Export: Disallow exported interface includes in src/build tree, 2014-03-31) it accidentally left a code path that would warn when the include dir is in the install tree but *not* in the source or build tree. Fix that.
-rw-r--r--Source/cmExportFileGenerator.cxx10
1 files changed, 6 insertions, 4 deletions
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 42fce6d..25ffe1a 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -277,6 +277,8 @@ static bool checkInterfaceDirs(const std::string &prepro,
" \"" << *li << "\"";
target->GetMakefile()->IssueMessage(messageType, e.str());
}
+ bool inBinary = isSubDirectory(li->c_str(), topBinaryDir);
+ bool inSource = isSubDirectory(li->c_str(), topSourceDir);
if (isSubDirectory(li->c_str(), installDir))
{
// The include directory is inside the install tree. If the
@@ -284,8 +286,8 @@ static bool checkInterfaceDirs(const std::string &prepro,
// fall through to the checks below that the include directory is not
// also inside the source tree or build tree.
bool shouldContinue =
- isSubDirectory(installDir, topBinaryDir)
- || isSubDirectory(installDir, topSourceDir);
+ (!inBinary || isSubDirectory(installDir, topBinaryDir)) &&
+ (!inSource || isSubDirectory(installDir, topSourceDir));
if (!shouldContinue)
{
@@ -317,7 +319,7 @@ static bool checkInterfaceDirs(const std::string &prepro,
continue;
}
}
- if (isSubDirectory(li->c_str(), topBinaryDir))
+ if (inBinary)
{
e << "Target \"" << target->GetName() << "\" "
"INTERFACE_INCLUDE_DIRECTORIES property contains path:\n"
@@ -326,7 +328,7 @@ static bool checkInterfaceDirs(const std::string &prepro,
}
if (!inSourceBuild)
{
- if (isSubDirectory(li->c_str(), topSourceDir))
+ if (inSource)
{
e << "Target \"" << target->GetName() << "\" "
"INTERFACE_INCLUDE_DIRECTORIES property contains path:\n"