From 82375189948c5740d57415c305534500984fc14f Mon Sep 17 00:00:00 2001 From: Alexander Neundorf Date: Fri, 15 Jun 2007 13:00:54 -0400 Subject: [PATCH] BUG: don't strip static libraries, it removes their symbol table, dynamic libs have an extra symbol table so they still work stripped Alex --- Source/cmInstallTargetGenerator.cxx | 27 ++++++++++++++++----------- Source/cmInstallTargetGenerator.h | 1 + 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index c38bcc7ab..1205f5c42 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/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, diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h index 6a8438729..35c16621b 100644 --- a/Source/cmInstallTargetGenerator.h +++ b/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,