Просмотр исходного кода

BUG: don't strip static libraries, it removes their symbol table, dynamic
libs have an extra symbol table so they still work stripped

Alex

Alexander Neundorf 18 лет назад
Родитель
Сommit
8237518994
2 измененных файлов с 17 добавлено и 11 удалено
  1. 16 11
      Source/cmInstallTargetGenerator.cxx
  2. 1 0
      Source/cmInstallTargetGenerator.h

+ 16 - 11
Source/cmInstallTargetGenerator.cxx

@@ -182,10 +182,10 @@ void cmInstallTargetGenerator::GenerateScript(std::ostream& os)
   quotedFullDestinationFilename += "/";
   quotedFullDestinationFilename += cmSystemTools::GetFilenameName(fromFile);
   quotedFullDestinationFilename += "\"";
-  
+
   this->AddRanlibRule(os, type, quotedFullDestinationFilename);
 
-  this->AddStripRule(os, quotedFullDestinationFilename, optional);
+  this->AddStripRule(os, type, quotedFullDestinationFilename, optional);
 }
 
 //----------------------------------------------------------------------------
@@ -453,10 +453,18 @@ void cmInstallTargetGenerator
 }
 
 void cmInstallTargetGenerator::AddStripRule(std::ostream& os, 
+                              cmTarget::TargetType type,
                               const std::string& quotedFullDestinationFilename,
                               bool optional)
 {
 
+  // don't strip static libraries, because it removes the only symbol table
+  // they have so you can't link to them anymore
+  if(type == cmTarget::STATIC_LIBRARY)
+    {
+    return;
+    }
+
   // Don't handle OSX Bundles.
   if(this->Target->GetMakefile()->IsOn("APPLE") &&
      this->Target->GetPropertyAsBool("MACOSX_BUNDLE"))
@@ -469,21 +477,18 @@ void cmInstallTargetGenerator::AddStripRule(std::ostream& os,
     return;
     }
 
-  os << "IF(CMAKE_INSTALL_DO_STRIP";
+  std::string optionalString;
   if (optional)
     {
-    os << " AND EXISTS " << quotedFullDestinationFilename;
+    optionalString = " AND EXISTS ";
+    optionalString += quotedFullDestinationFilename;
     }
-  os << ")\n";
+
+  os << "IF(CMAKE_INSTALL_DO_STRIP" << optionalString << ")\n";
   os << "  EXECUTE_PROCESS(COMMAND \""
      << this->Target->GetMakefile()->GetDefinition("CMAKE_STRIP")
      << "\" " << quotedFullDestinationFilename << " )\n";
-  os << "ENDIF(CMAKE_INSTALL_DO_STRIP";
-  if (optional)
-    {
-    os << " AND EXISTS " << quotedFullDestinationFilename;
-    }
-  os << ")\n";
+  os << "ENDIF(CMAKE_INSTALL_DO_STRIP" << optionalString << ")\n";
 }
 
 void cmInstallTargetGenerator::AddRanlibRule(std::ostream& os, 

+ 1 - 0
Source/cmInstallTargetGenerator.h

@@ -45,6 +45,7 @@ protected:
                                  bool useSOName);
   void AddInstallNamePatchRule(std::ostream& os, const char* destination);
   void AddStripRule(std::ostream& os, 
+                    cmTarget::TargetType type,
                     const std::string& quotedFullDestinationFilename, 
                     bool optional);
   void AddRanlibRule(std::ostream& os,