mirror of
https://github.com/reactos/CMake.git
synced 2024-11-25 04:29:52 +00:00
Error if linked target has relative paths in INTERFACE_INCLUDE_DIRECTORIES
We can do this check only if the TargetName is non-empty, which means that we're evaluating INTERFACE_INCLUDE_DIRECTORIES from a linked dependency which was set using target_link_libraries. It is possible to have relative paths in INCLUDE_DIRECTORIES already in CMake 2.8.10.2, so that part will require a policy to fix.
This commit is contained in:
parent
28051f1150
commit
634bb33f3a
@ -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);
|
||||
|
@ -0,0 +1 @@
|
||||
1
|
@ -0,0 +1,5 @@
|
||||
CMake Error in CMakeLists.txt:
|
||||
Target "testTarget" contains relative path in its
|
||||
INTERFACE_INCLUDE_DIRECTORIES:
|
||||
|
||||
"foo"
|
@ -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)
|
@ -7,3 +7,4 @@ run_cmake(SourceDirectoryInInterface)
|
||||
run_cmake(BinaryDirectoryInInterface)
|
||||
run_cmake(RelativePathInInterface)
|
||||
run_cmake(ImportedTarget)
|
||||
run_cmake(RelativePathInGenex)
|
||||
|
Loading…
Reference in New Issue
Block a user