Revert "Allow target_link_libraries with IMPORTED targets."

This reverts commit 9cfe4f1b76.

It turns out that correctly adding the content to
the IMPORTED_LINK_INTERFACE_LIBARIES_<CONFIG> of an upstream target
from the buildsystem of a downstream project is not simple.

If upstream had added the INTERFACE content, the config-specific
properties would  be determined by the DEBUG_CONFIGURATIONS of
upstream.

As downstream, we don't have any information about what
the DEBUG_CONFIGURATIONS of upstream were, so we can't determine
which configuration-specific properties to populate. The best we can do
is add it to all of them or add it to the ones downstream considers to
be DEBUG_CONFIGURATIONS, neither of which is a good solution.

So, removing the porcelain API for that is the best approach. A human
can still determine which properties to populate and use
the set_property API to populate the desired properies.

Another solution to this would be for upstream targets to publish
what they consider DEBUG_CONFIGURATIONS, but that can be added in
a future release.
This commit is contained in:
Stephen Kelly 2013-01-21 12:05:01 +01:00
parent 3ded614e31
commit 48a4cf2182
2 changed files with 0 additions and 17 deletions

View File

@ -33,10 +33,6 @@ bool cmTargetLinkLibrariesCommand
this->Target = this->Target =
this->Makefile->GetCMakeInstance() this->Makefile->GetCMakeInstance()
->GetGlobalGenerator()->FindTarget(0, args[0].c_str()); ->GetGlobalGenerator()->FindTarget(0, args[0].c_str());
if(!this->Target)
{
this->Target = this->Makefile->FindTargetToUse(args[0].c_str());
}
if(!this->Target) if(!this->Target)
{ {
cmake::MessageType t = cmake::FATAL_ERROR; // fail by default cmake::MessageType t = cmake::FATAL_ERROR; // fail by default
@ -261,16 +257,6 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const char* lib,
// Handle normal case first. // Handle normal case first.
if(this->CurrentProcessingState != ProcessingLinkInterface) if(this->CurrentProcessingState != ProcessingLinkInterface)
{ {
if (this->Target->IsImported())
{
cmOStringStream e;
e << "Imported targets may only be used with the "
"LINK_INTERFACE_LIBRARIES specifier to target_link_libraries.";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
return;
}
this->Makefile this->Makefile
->AddLinkLibraryForTarget(this->Target->GetName(), lib, llt); ->AddLinkLibraryForTarget(this->Target->GetName(), lib, llt);
if (this->CurrentProcessingState != ProcessingPublicInterface) if (this->CurrentProcessingState != ProcessingPublicInterface)

View File

@ -29,9 +29,6 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
add_library(depA SHARED depA.cpp) add_library(depA SHARED depA.cpp)
generate_export_header(depA) generate_export_header(depA)
add_library(importedlib UNKNOWN IMPORTED)
target_link_libraries(importedlib LINK_INTERFACE_LIBRARIES depA)
add_library(depB SHARED depB.cpp) add_library(depB SHARED depB.cpp)
generate_export_header(depB) generate_export_header(depB)