summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-03-28 14:42:42 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2013-03-28 14:42:42 (GMT)
commit2afcbe3090d73a7d5c81a726cb9be0efaedb858c (patch)
treed7a04f74cbc389032ded03deef872d945731e7f8
parent1c7833e7ae39f5145ab753492659bb73db5514f6 (diff)
parent634bb33f3aa3b7f2181a896c025976b52171524a (diff)
downloadCMake-2afcbe3090d73a7d5c81a726cb9be0efaedb858c.zip
CMake-2afcbe3090d73a7d5c81a726cb9be0efaedb858c.tar.gz
CMake-2afcbe3090d73a7d5c81a726cb9be0efaedb858c.tar.bz2
Merge topic 'error-on-exported-missing-include-dir'
634bb33 Error if linked target has relative paths in INTERFACE_INCLUDE_DIRECTORIES
-rw-r--r--Source/cmTarget.cxx14
-rw-r--r--Tests/RunCMake/include_directories/RelativePathInGenex-result.txt1
-rw-r--r--Tests/RunCMake/include_directories/RelativePathInGenex-stderr.txt5
-rw-r--r--Tests/RunCMake/include_directories/RelativePathInGenex.cmake8
-rw-r--r--Tests/RunCMake/include_directories/RunCMakeTest.cmake1
5 files changed, 29 insertions, 0 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 52a2732..66c22b1 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -2842,6 +2842,20 @@ static void processIncludeDirectories(cmTarget *tgt,
return;
}
+ if (!cmSystemTools::FileIsFullPath(li->c_str()))
+ {
+ if (!(*it)->TargetName.empty())
+ {
+ cmOStringStream e;
+ e << "Target \"" << (*it)->TargetName << "\" contains relative "
+ "path in its INTERFACE_INCLUDE_DIRECTORIES:\n"
+ " \"" << *li << "\" ";
+ tgt->GetMakefile()->IssueMessage(cmake::FATAL_ERROR,
+ e.str().c_str());
+ return;
+ }
+ }
+
if (testIsOff && !cmSystemTools::IsOff(li->c_str()))
{
cmSystemTools::ConvertToUnixSlashes(*li);
diff --git a/Tests/RunCMake/include_directories/RelativePathInGenex-result.txt b/Tests/RunCMake/include_directories/RelativePathInGenex-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/include_directories/RelativePathInGenex-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/include_directories/RelativePathInGenex-stderr.txt b/Tests/RunCMake/include_directories/RelativePathInGenex-stderr.txt
new file mode 100644
index 0000000..490c700
--- /dev/null
+++ b/Tests/RunCMake/include_directories/RelativePathInGenex-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error in CMakeLists.txt:
+ Target "testTarget" contains relative path in its
+ INTERFACE_INCLUDE_DIRECTORIES:
+
+ "foo"
diff --git a/Tests/RunCMake/include_directories/RelativePathInGenex.cmake b/Tests/RunCMake/include_directories/RelativePathInGenex.cmake
new file mode 100644
index 0000000..f72cf3a
--- /dev/null
+++ b/Tests/RunCMake/include_directories/RelativePathInGenex.cmake
@@ -0,0 +1,8 @@
+
+project(RelativePathInInterface)
+
+add_library(testTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp")
+set_property(TARGET testTarget PROPERTY INTERFACE_INCLUDE_DIRECTORIES "$<1:foo>")
+
+add_library(userTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp")
+target_link_libraries(userTarget testTarget)
diff --git a/Tests/RunCMake/include_directories/RunCMakeTest.cmake b/Tests/RunCMake/include_directories/RunCMakeTest.cmake
index 1caae5c..f516086 100644
--- a/Tests/RunCMake/include_directories/RunCMakeTest.cmake
+++ b/Tests/RunCMake/include_directories/RunCMakeTest.cmake
@@ -7,3 +7,4 @@ run_cmake(SourceDirectoryInInterface)
run_cmake(BinaryDirectoryInInterface)
run_cmake(RelativePathInInterface)
run_cmake(ImportedTarget)
+run_cmake(RelativePathInGenex)