diff options
author | Alexander Neundorf <neundorf@kde.org> | 2007-06-15 15:12:07 (GMT) |
---|---|---|
committer | Alexander Neundorf <neundorf@kde.org> | 2007-06-15 15:12:07 (GMT) |
commit | 69d362846161e14002377a66e7505219b2b6af27 (patch) | |
tree | bfd2b871ed84bf80c09ae4675890481f271198f4 /Source/cmInstallTargetGenerator.cxx | |
parent | fe45c1966677ef8807f36d586159e7e74934b1db (diff) | |
download | CMake-69d362846161e14002377a66e7505219b2b6af27.zip CMake-69d362846161e14002377a66e7505219b2b6af27.tar.gz CMake-69d362846161e14002377a66e7505219b2b6af27.tar.bz2 |
BUG: don't run strip on OPTIONAL install targets if the file doesn't exist
Alex
Diffstat (limited to 'Source/cmInstallTargetGenerator.cxx')
-rw-r--r-- | Source/cmInstallTargetGenerator.cxx | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 45e715f..c38bcc7 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -177,13 +177,15 @@ void cmInstallTargetGenerator::GenerateScript(std::ostream& os) this->AddInstallNamePatchRule(os, destination.c_str()); } - std::string destinationFilename = destination; - destinationFilename += "/"; - destinationFilename += cmSystemTools::GetFilenameName(fromFile); - - this->AddRanlibRule(os, type, destinationFilename); + std::string quotedFullDestinationFilename = "\"$ENV{DESTDIR}"; + quotedFullDestinationFilename += destination; + quotedFullDestinationFilename += "/"; + quotedFullDestinationFilename += cmSystemTools::GetFilenameName(fromFile); + quotedFullDestinationFilename += "\""; + + this->AddRanlibRule(os, type, quotedFullDestinationFilename); - this->AddStripRule(os, destinationFilename); + this->AddStripRule(os, quotedFullDestinationFilename, optional); } //---------------------------------------------------------------------------- @@ -451,7 +453,8 @@ void cmInstallTargetGenerator } void cmInstallTargetGenerator::AddStripRule(std::ostream& os, - const std::string& destinationFilename) + const std::string& quotedFullDestinationFilename, + bool optional) { // Don't handle OSX Bundles. @@ -466,16 +469,26 @@ void cmInstallTargetGenerator::AddStripRule(std::ostream& os, return; } - os << "IF(CMAKE_INSTALL_DO_STRIP)\n"; - os << " EXECUTE_PROCESS(COMMAND \""; - os << this->Target->GetMakefile()->GetDefinition("CMAKE_STRIP"); - os << "\" \"$ENV{DESTDIR}" << destinationFilename << "\" )\n"; - os << "ENDIF(CMAKE_INSTALL_DO_STRIP)\n"; + os << "IF(CMAKE_INSTALL_DO_STRIP"; + if (optional) + { + os << " AND EXISTS " << quotedFullDestinationFilename; + } + os << ")\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"; } void cmInstallTargetGenerator::AddRanlibRule(std::ostream& os, - cmTarget::TargetType type, - const std::string& destinationFilename) + cmTarget::TargetType type, + const std::string& quotedFullDestinationFilename) { // Static libraries need ranlib on this platform. if(type != cmTarget::STATIC_LIBRARY) @@ -499,5 +512,5 @@ void cmInstallTargetGenerator::AddRanlibRule(std::ostream& os, os << "EXECUTE_PROCESS(COMMAND \""; os << ranlib; - os << "\" \"$ENV{DESTDIR}" << destinationFilename << "\" )\n"; + os << "\" " << quotedFullDestinationFilename << " )\n"; } |