From 0e03bd1ab4789081050761342d5fdf4aa9cf0824 Mon Sep 17 00:00:00 2001
From: Brad King <brad.king@kitware.com>
Date: Tue, 25 Nov 2008 16:50:48 -0500
Subject: [PATCH] BUG: Do not map install_name of imported targets

When we install a target on Mac, we generate a call to install_name_tool to fix
install_name entries in the target for shared libraries it links.  This change
makes the step ignore entries for imported targets since their install_name
will not change and cmTarget cannot produce a mapping for them.  This fixes the
error

  GetLibraryNamesInternal called on imported target: kdelibs

seen by kde folks.
---
 Source/cmInstallTargetGenerator.cxx | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 68dd586849..fabcb0a703 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -489,10 +489,17 @@ cmInstallTargetGenerator
     for(std::set<cmTarget*>::const_iterator j = sharedLibs.begin();
         j != sharedLibs.end(); ++j)
       {
+      cmTarget* tgt = *j;
+
+      // The install_name of an imported target does not change.
+      if(tgt->IsImported())
+        {
+        continue;
+        }
+
       // If the build tree and install tree use different path
       // components of the install_name field then we need to create a
       // mapping to be applied after installation.
-      cmTarget* tgt = *j;
       std::string for_build = tgt->GetInstallNameDirForBuildTree(config);
       std::string for_install = tgt->GetInstallNameDirForInstallTree(config);
       if(for_build != for_install)
-- 
GitLab