Browse Source

BUG: Remove InstallNameFixupPath from cmTarget and cmInstallTargetGenerator.

  - Motivation:
    - It depended on the order of installation
    - It supported only a single destination for each target
    - It created directory portions of an install name without user request
  - Updated ExportImport test to install targets in an order that expoed
    this bug
Brad King 18 years ago
parent
commit
16186ec18c
3 changed files with 30 additions and 48 deletions
  1. 22 27
      Source/cmInstallTargetGenerator.cxx
  2. 0 13
      Source/cmTarget.h
  3. 8 8
      Tests/ExportImport/Export/CMakeLists.txt

+ 22 - 27
Source/cmInstallTargetGenerator.cxx

@@ -280,8 +280,6 @@ cmInstallTargetGenerator
     }
   toDestDirPath += toInstallPath;
 
-  this->Target->SetInstallNameFixupPath(toInstallPath.c_str());
-
   os << indent << "IF(EXISTS \"" << toDestDirPath << "\")\n";
   this->AddInstallNamePatchRule(os, indent.Next(), config, toDestDirPath);
   this->AddChrpathPatchRule(os, indent.Next(), config, toDestDirPath);
@@ -394,23 +392,19 @@ cmInstallTargetGenerator
       cmTarget* tgt = *j;
       std::string for_build = tgt->GetInstallNameDirForBuildTree(config);
       std::string for_install = tgt->GetInstallNameDirForInstallTree(config);
-      std::string fname = this->GetInstallFilename(tgt, config, false, true);
+      if(for_build != for_install)
+        {
+        // The directory portions differ.  Append the filename to
+        // create the mapping.
+        std::string fname =
+          this->GetInstallFilename(tgt, config, false, true);
 
-      // Map from the build-tree install_name.
-      for_build += fname;
+        // Map from the build-tree install_name.
+        for_build += fname;
 
-      // Map to the install-tree install_name.
-      if (!for_install.empty())
-        {
+        // Map to the install-tree install_name.
         for_install += fname;
-        }
-      else
-        {
-        for_install = tgt->GetInstallNameFixupPath();
-        }
 
-      if(for_build != for_install)
-        {
         // Store the mapping entry.
         install_name_remap[for_build] = for_install;
         }
@@ -421,26 +415,27 @@ cmInstallTargetGenerator
   std::string new_id;
   if(this->Target->GetType() == cmTarget::SHARED_LIBRARY)
     {
-    std::string for_build = 
+    std::string for_build =
       this->Target->GetInstallNameDirForBuildTree(config);
-    std::string for_install = 
+    std::string for_install =
       this->Target->GetInstallNameDirForInstallTree(config);
-    std::string fname =
-      this->GetInstallFilename(this->Target, config, this->ImportLibrary,
-                               true);
-    for_build += fname;
-    if (!for_install.empty())
-      {
-      for_install += fname;
-      }
-    else
+
+    if(this->Target->IsFrameworkOnApple() && for_install.empty())
       {
-      for_install = this->Target->GetInstallNameFixupPath();
+      // Frameworks seem to have an id corresponding to their own full
+      // path.
+      // ...
+      // for_install = fullDestPath_without_DESTDIR_or_name;
       }
+
+    // If the install name will change on installation set the new id
+    // on the installed file.
     if(for_build != for_install)
       {
       // Prepare to refer to the install-tree install_name.
       new_id = for_install;
+      new_id += this->GetInstallFilename(this->Target, config,
+                                         this->ImportLibrary, true);
       }
     }
 

+ 0 - 13
Source/cmTarget.h

@@ -191,18 +191,6 @@ public:
   bool GetHaveInstallRule() { return this->HaveInstallRule; }
   void SetHaveInstallRule(bool h) { this->HaveInstallRule = h; }
 
-  /**
-   * Get/Set the path needed for calls to install_name_tool regarding this
-   * target. Used to support fixing up installed libraries and executables on
-   * the Mac (including bundles and frameworks). Only used if the target does
-   * not have an INSTALL_NAME_DIR property.
-   * See cmInstallTargetGenerator::AddInstallNamePatchRule and callers for
-   * more information.
-   */
-  std::string GetInstallNameFixupPath() { return this->InstallNameFixupPath; }
-  void SetInstallNameFixupPath(const char *path) {
-    this->InstallNameFixupPath = path; }
-
   /** Add a utility on which this project depends. A utility is an executable
    * name as would be specified to the ADD_EXECUTABLE or UTILITY_SOURCE
    * commands. It is not a full path nor does it have an extension.
@@ -465,7 +453,6 @@ private:
   std::vector<std::string> LinkDirectories;
   std::set<cmStdString> LinkDirectoriesEmmitted;
   bool HaveInstallRule;
-  std::string InstallNameFixupPath;
   std::string InstallPath;
   std::string RuntimeInstallPath;
   std::string OutputDir;

+ 8 - 8
Tests/ExportImport/Export/CMakeLists.txt

@@ -35,14 +35,6 @@ add_executable(testExe3 testExe3.c)
 set_property(TARGET testExe3 PROPERTY MACOSX_BUNDLE 1)
 
 # Install and export from install tree.
-install(
-  TARGETS
-  testExe2libImp testLib3Imp
-  EXPORT exp
-  RUNTIME DESTINATION bin
-  LIBRARY DESTINATION lib/impl
-  ARCHIVE DESTINATION lib/impl
-  )
 install(
   TARGETS
   testExe1 testLib1 testLib2 testExe2 testLib3 testLib4 testExe3
@@ -54,6 +46,14 @@ install(
   FRAMEWORK DESTINATION Frameworks
   BUNDLE DESTINATION Applications
   )
+install(
+  TARGETS
+  testExe2libImp testLib3Imp
+  EXPORT exp
+  RUNTIME DESTINATION bin
+  LIBRARY DESTINATION lib/impl
+  ARCHIVE DESTINATION lib/impl
+  )
 install(EXPORT exp NAMESPACE exp_ DESTINATION lib/exp)
 
 # Export from build tree.