Don't populate INTERFACE includes and defines properties in tll.

This is a partial revert of commit 77cecb77 (Add includes and compile
definitions with target_link_libraries., 2012-11-05).

As the interface includes and defines are now determined by the link
closure, there is no need to populate the corresponding properties
explicitly.
This commit is contained in:
Stephen Kelly 2013-02-12 11:58:50 +01:00
parent 567c8d103e
commit e1f908015f
3 changed files with 16 additions and 55 deletions

View File

@ -251,43 +251,11 @@ cmTargetLinkLibrariesCommand
this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str());
}
//----------------------------------------------------------------------------
static std::string compileProperty(cmTarget *tgt, const std::string &lib,
bool isGenex,
const std::string &property,
cmTarget::LinkLibraryType llt)
{
std::string value = !isGenex ? "$<LINKED:" + lib + ">"
: "$<$<TARGET_DEFINED:" + lib + ">:" +
"$<TARGET_PROPERTY:" + lib +
",INTERFACE_" + property + ">"
">";
return tgt->GetDebugGeneratorExpressions(value, llt);
}
//----------------------------------------------------------------------------
void
cmTargetLinkLibrariesCommand::HandleLibrary(const char* lib,
cmTarget::LinkLibraryType llt)
{
const bool isGenex = cmGeneratorExpression::Find(lib) != std::string::npos;
const bool potentialTargetName
= cmGeneratorExpression::IsValidTargetName(lib);
if (potentialTargetName || isGenex)
{
this->Target->AppendProperty("INCLUDE_DIRECTORIES",
compileProperty(this->Target, lib,
isGenex,
"INCLUDE_DIRECTORIES", llt).c_str());
this->Target->AppendProperty("COMPILE_DEFINITIONS",
compileProperty(this->Target, lib,
isGenex,
"COMPILE_DEFINITIONS", llt).c_str());
}
// Handle normal case first.
if(this->CurrentProcessingState != ProcessingLinkInterface)
{
@ -308,18 +276,6 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const char* lib,
}
}
if (potentialTargetName || isGenex)
{
this->Target->AppendProperty("INTERFACE_COMPILE_DEFINITIONS",
compileProperty(this->Target, lib,
isGenex,
"COMPILE_DEFINITIONS", llt).c_str());
this->Target->AppendProperty("INTERFACE_INCLUDE_DIRECTORIES",
compileProperty(this->Target, lib,
isGenex,
"INCLUDE_DIRECTORIES", llt).c_str());
}
// Get the list of configurations considered to be DEBUG.
std::vector<std::string> const& debugConfigs =
this->Makefile->GetCMakeInstance()->GetDebugConfigs();

View File

@ -23,21 +23,22 @@ CMake Debug Log at DebugIncludes.cmake:18 \(include_directories\):
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
+
CMake Debug Log at DebugIncludes.cmake:26 \(target_link_libraries\):
CMake Debug Log at DebugIncludes.cmake:33 \(set_property\):
Used includes for target lll:
\* .*/Tests/RunCMake/include_directories/five
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
+
CMake Debug Log at DebugIncludes.cmake:29 \(set_property\):
Used includes for target lll:
\* .*/Tests/RunCMake/include_directories/six
\* .*/Tests/RunCMake/include_directories/seven
Call Stack \(most recent call first\):
DebugIncludes.cmake:40 \(some_macro\)
DebugIncludes.cmake:43 \(some_function\)
DebugIncludes.cmake:44 \(some_macro\)
DebugIncludes.cmake:47 \(some_function\)
CMakeLists.txt:3 \(include\)
+
CMake Debug Log at DebugIncludes.cmake:30 \(target_link_libraries\):
Used includes for target lll:
\* .*/Tests/RunCMake/include_directories/eight
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

View File

@ -22,7 +22,11 @@ include_directories(
)
add_library(foo "${CMAKE_CURRENT_BINARY_DIR}/DebugIncludes.cpp")
target_include_directories(foo INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/five")
target_include_directories(foo
INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/seven"
"${CMAKE_CURRENT_SOURCE_DIR}/eight"
)
target_link_libraries(lll foo)
macro(some_macro)