objlib: Allow other libraries to link to OBJECT libraries.

Note: This only allows `OBJECT` libraries to be on the right-hand side
of `target_link_libraries` but still does not link its object-files to
the target on the left-hand side.

Issue: #14778
This commit is contained in:
Deniz Bahadir
2017-11-24 17:20:18 +01:00
committed by Brad King
parent 51249e69ea
commit dfb6e84082
20 changed files with 94 additions and 66 deletions
+3 -1
View File
@@ -159,7 +159,9 @@ cmStateEnums::TargetType cmExportBuildFileGenerator::GetExportTargetType(
{
cmStateEnums::TargetType targetType = target->GetType();
// An object library exports as an interface library if we cannot
// tell clients where to find the objects.
// tell clients where to find the objects. This is sufficient
// to support transitive usage requirements on other targets that
// use the object library.
if (targetType == cmStateEnums::OBJECT_LIBRARY &&
!this->LG->GetGlobalGenerator()->HasKnownObjectFileLocation(nullptr)) {
targetType = cmStateEnums::INTERFACE_LIBRARY;